Redirecting error output
Author
Discussion

pdV6

Original Poster:

16,442 posts

291 months

Wednesday 10th May 2006
quotequote all
Quick question if I may...

From a command prompt in Windows/Dos, you can redirect standard output to a file by using ">".
example said:

C:\\>MyApp.exe > output.txt

I'm sure you can do the same with error output but for the life of me I can't remember how.

Any ideas?

__LEE__

7,520 posts

273 months

Wednesday 10th May 2006
quotequote all
How are you running the command?

If you are running it from the dos prompt you should be able to do 'command > XXX.txt' and this output the execution/non execution of the command.

pdV6

Original Poster:

16,442 posts

291 months

Wednesday 10th May 2006
quotequote all
As you were. I found it.

In case anyone was interested (as if!), its:

C:\>Myapp.exe 2> output.txt

>> Edited by pdV6 on Wednesday 10th May 10:35

pdV6

Original Poster:

16,442 posts

291 months

Wednesday 10th May 2006
quotequote all
__LEE__ said:
How are you running the command?

If you are running it from the dos prompt you should be able to do 'command > XXX.txt' and this output the execution/non execution of the command.

Yes - that's for the standard output of the command. I specifically needed the error output.
Anyway, I found it (see above).

Cheers.

pdV6

Original Poster:

16,442 posts

291 months

Wednesday 10th May 2006
quotequote all
time again.

To get both standard and error output into a file, you need to do

C:\>MyApp.exe > output.txt 2>&1

What fun.

__LEE__

7,520 posts

273 months

Wednesday 10th May 2006
quotequote all
Cool.

Ok, thanks.


>> Edited by __LEE__ on Wednesday 10th May 10:42