So, I think I may be going insane. This batch script:
@Echo on
dir > dir.txt
generates the following on the console it is run from:
dir 1>dir.txt
I expected to see simply dir > dir.txt. Any ideas why this is happening? This is on Windows XP SP2 in the standard command prompt.
The 1 is the file descriptor for standard output. Therefore, these two commands are equivalent.
As a side note, you can redirect errors by redirecting descriptor 2, like this:
There’s a nice summary of what you can do with redirection here.