user837208
user837208

Reputation: 2577

escaping space in bash shell

I am trying to use WinExe to execute a command line on a Windows machine. 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.

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 -

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.

Upvotes: 0

Views: 995

Answers (1)

htoip
htoip

Reputation: 439

Try doubling-up your quotation marks as you did for the sha256sum command.

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

Upvotes: 1

Related Questions