2008/01/01

Stdout and Stderr Redirection on Windows

On Linux with bash, I log both stdout and stderr out by following method

$> foo &> out.txt

But, cmd on Windows does not support the method.

On Windows you can use following method

C:\> (foo.exe 2>&1) > out.txt

"2>" means redirection from stderr(2). So, ">" equals "1>" and the '1' means stdout(1). If you want to log stdout and stderr to each file, you can use following command.

C:\> foo.exe > out.txt 2> err.txt

No comments:

How to set parameters to debugging program on Visual Studio 2019 with CMake

Solution: MSDN Sometimes the "Debug and Launch Settings for CMake" bottun is disabled. In this case, change to the target view. ...