简体   繁体   English

在bash shell中转义空间

[英]escaping space in bash shell

I am trying to use WinExe to execute a command line on a Windows machine. 我正在尝试使用WinExe在Windows计算机上执行命令行。 So far I am able to execute a file (sha256sum.exe) and pass parameter like "--help" to it but I am not able to pass any filename with space in it. 到目前为止,我已经能够执行文件(sha256sum.exe)并将诸如“ --help”之类的参数传递给该文件,但是我无法传递任何带有空格的文件名。

Here is how my command line looks like- 这是我的命令行的样子-

./winexe --ostype=2  -U username --password passworsGoesHere //hostIP "cmd /c  \"\"%programfiles%\\MyApp\\tools\\sha256sum.exe\"\" \"c:\1 1.txt\" "

The filename is 1 1.txt under C:\\ and output of command is - C:\\下的文件名是1 1.txt ,命令的输出是-

The filename, directory name, or volume label syntax is incorrect.

If I execute this- 如果我执行此-

./winexe --ostype=2  -U username --password passworsGoesHere //hostIP "cmd /c  \"\"%programfiles%\\MyApp\\tools\\sha256sum.exe\"\" --help "

it works. 有用。

像对sha256sum命令一样,尝试将引号加倍。

./winexe --ostype=2  -U username --password passworsGoesHere //hostIP "cmd /c  \"\"%programfiles%\\MyApp\\tools\\sha256sum.exe\"\" \"\"c:\1 1.txt\"\" "

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM