You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm attempting to run this Win32 command through bash:
cmd.exe /c for %A in ("C:\Documents and Settings") do @echo %~sA
The correctly escaped command for bash is:
cmd.exe /c for %A in '("C:\Documents and Settings")' do @echo %~sA
However, this results in this error:
"("C:\Documents was unexpected at this time.
Using this command from bash:
cmd.exe /c echo for %A in '("C:\Documents and Settings")' do @echo %~sA
I can see that the command was transformed into:
for %A in "("C:\Documents and Settings")" do @echo %~sA
The "(\" should be just (" and the \")" should be )"
However, this appears to be special escaping for cmd.exe. If I run another executable, in this case a C++ executable that just prints out the arguments, I get the correct arguments:
test.exe /c for %A in '("C:\Documents and Settings")' do @echo %~sA
C:\Users\Andrew\source\repos\test\x64\Release\test.exe
/c
for
%A
in
("C:\Documents and Settings")
do @echo
%~sA
The source for test.exe is below:
#include <iostream>
#include <string>
int main(int argc, char* argv[])
{
for (int n(0); n < argc; ++n)
{
::std::cout << argv[n] << ::std::endl;
}
return 0;
}
Details of my environment:
uname -a:
Linux DESKTOP 4.4.0-17763-Microsoft #194-Microsoft Mon Dec 03 17:58:00 PST 2018 x86_64 x86_64 x86_64 GNU/Linux
ver:
Microsoft Windows [Version 10.0.17763.195]
The text was updated successfully, but these errors were encountered:
I confirmed that this still occurs in a recent insider build:
uname -a: Linux DESKTOP-HLO5ULF 4.4.0-18917-Microsoft #1000-Microsoft Fri Jun 07 19:42:00 PST 2019 x86_64 x86_64 x86_64 GNU/Linux
ver: Microsoft Windows [Version 10.0.18917.1000]
Also tested in WSL2 with same results.
uname -a for WSL2: Linux DESKTOP-HLO5ULF 4.19.43-microsoft-standard #1 SMP Mon May 20 19:35:22 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
This issue has been automatically closed since it has not had any activity for the past year. If you're still experiencing this issue please re-file this as a new issue or feature request.
I'm attempting to run this Win32 command through bash:
cmd.exe /c for %A in ("C:\Documents and Settings") do @echo %~sA
The correctly escaped command for bash is:
cmd.exe /c for %A in '("C:\Documents and Settings")' do @echo %~sA
However, this results in this error:
Using this command from bash:
cmd.exe /c echo for %A in '("C:\Documents and Settings")' do @echo %~sA
I can see that the command was transformed into:
The
"(\"
should be just("
and the\")"
should be)"
However, this appears to be special escaping for cmd.exe. If I run another executable, in this case a C++ executable that just prints out the arguments, I get the correct arguments:
test.exe /c for %A in '("C:\Documents and Settings")' do @echo %~sA
The source for test.exe is below:
Details of my environment:
uname -a:
ver:
The text was updated successfully, but these errors were encountered: