What the question says.
Ultimately what I want is to execute gcc and capture the output if there's an error. The problem is errors are written to stderr instead of stdout. On Linux I can do
gcc foo.c 2>&1
How can I accomplish this on Windows?
What the question says.
Ultimately what I want is to execute gcc and capture the output if there's an error. The problem is errors are written to stderr instead of stdout. On Linux I can do
gcc foo.c 2>&1
How can I accomplish this on Windows?
There is. Simply right click into the console window, select Mark
. With your mouse select the desired area and right click. Now you can paste it into a text file with Ctrl-V.
If you need the output of a program into a text file, run it like this:
myprogram.exe > myfile.txt
See here about redirecting:
1. Using command redirection operators
2. Redirecting Error Messages from Command Prompt: STDERR/STDOUT
You can do what you want like this: D:\>dir 1> test.txt 2> testerr.txt
If you want the output of a particular command, there's a simple way to push console output to a file.
Here's a trivial example using the 'dir' command (the leading > represents your prompt):
>dir > diroutput.txt