I wrote a shell GUI application that starts a console application with CreateProcessW, then terminates and leaves the console application running.
Now I would like to turn on the debug output of the console application and redirect its output to a file.
I could organize pipes to redirect the output, but I want that the GUI application terminates and leaves things alone. So I decided to launch cmd.exe and use its standard redirection symbols:
"C:\Windows\System32\cmd.exe" /c "C:\Program Files (x86)\ConsoleProgram\ConsoleProgram.exe" -debug > "R:\log.txt" 2>&1
It writes to the log.txt file:
"C:\Program" is not recognized as an internal or external command, operable program or batch file.
When I use "/C/Program Files (x86)/ConsoleProgram/ConsoleProgram.exe" instead, it writes:
system could not find the path specified