1.

Solve : Redirecting in DOS BAT Files?

Answer»

I am running Windows XP, SP3. The output of the VER command from the Command Prompt window is Microsoft Windows XP [Version 5.1.2600].

Typing a command line works fine:

DIR L: >>D:TESTOUT.TXT

When run from a BAT file, the command RESOLVES to this:

DIR L: 1>>D:TESTOUT.TXT

That is not the only command where this HAPPENS. The BAT file seems to work with this, but a really old version of PKZIP does not like it when run from the BAT file and does not run. I really wanted to capture the output of the PKZIP command in my "TESTOUT.TXT" file. What is happening; how do I prevent these "1"'s?

Thank you!
Bob Brown
Cranberry Twp, PA (Pittsburgh)Tbis is normal. What you see is the command interpreter expanding the redirection operator to show the stream number (1) for stdout; the other one is 2 for stderr. You can't stop it; why do you need to? If you want to hide the commands just put @echo off as the first line of the batch.Thank you. It turns out the reason PKZIP wouldn't work, which is what MADE me post, is I had it commented out. Since then, I have switched from "REM"s to "ECHO"s when I want the commands to show up in the redirected output file. Everything is fine now. - Bob B.



Discussion

No Comment Found