Consider this dummy Windows batch script:
echo %1
Supposed just to echo to the terminal its first argument.
Assume its path in resp. Windows, Cygwin style is:
c:\test\win.bat
/cygdrive/c/test/win.bat
From Cygwin bash:
$ c:\test\win.bat "hello world"
"hello world"
So quotes correctly identify a single argument.
But now let us introduce spaces in path:
"c:\te st\win.bat"
/cygdrive/c/te\ st/win.bat
Then:
$ /cygdrive/c/te\ st/win.bat "hello world"
Gives:
"C:\te" is not recognized as an internal or external command, operable program or batch file.
The same happens with:
$ "/cygdrive/c/te st/win.bat" "hello world"
It should be noted this:
$ /cygdrive/c/te\ st/win.bat "hello"
hello
That is hello
is now passed to win.bat
unquoted (and with "/cygdrive/c/te st/win.bat" "hello"
either).
How can I have spaces both in the path and the argument?