In some automated tests I put double-quotes around every command given to an executable, e.g.
notepad "hello.txt"
This works correctly. Also if I try the same with other executables this always seem to work. However, the following doesn’t work on Windows 7:
cmd.exe "/c" "echo hello"
The problem isn’t the quotes around “echo hello”, but it doesn’t seem to like the quotes around the /c option. All I get is the following output:
'"echo hello' is not recognized as an internal or external command, operable program or batch file.
Is cmd.exe handled differently by Windows?
“hello.txt” is a filename, and in general you only quote filenames/paths (and other parameters that might contain spaces)
And yes, cmd.exe probably has some special handling, you can use /S to change the quote handling.
IMHO “/c” is bad practice anyway, it looks like you want to execute c.exe at the root of the current drive