简体   繁体   中英

cmd.exe vs. cmd output

I am running Cygwin on Windows and occasionally I need to call cmd.exe from Bash.

However I have noticed that I am getting different results depending on how I call it

$ cmd.exe /c 'echo "http://asdf.com?a=1&b=2"'
"http://asdf.com?a=1&b=2"

$ cmd /c 'echo "http://asdf.com?a=1&b=2"'
\"http://asdf.com?a=1&b=2\"

Why is this happening?

I noticed if you call it like this it is closer to the cmd.exe output. Adding a space inside the quotes changes the output.

$ cmd /c echo 'http://asdf.com?a=1&b=2 '
"http://asdf.com?a=1&b=2 "

More information

one or more whitespace characters between the the two quote characters

CMD.exe (Command Shell)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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