Link to home
Create AccountLog in
Avatar of Locutus_NYC
Locutus_NYC

asked on

BATCH FILES: When sending output to a file, >> becomes 1>>. Why?

Im making a batch file in DOS and trying to put >NUL or >>(filename) at the end of lines but when I run it and see the output it comes out wrong...

>NUL becomes 1>NUL and >>(filename) becomes 1>>(filename).

These 1's are wreaking havoc on my scripts.. anyone know why this is happening?

Avatar of knightEknight
knightEknight
Flag of United States of America image

1>nul is the same as >nul in this context, for example:

dir  1>nul

1 indicates stdout, whereas 2 indicates stderr:

dir  \\server\share  2> err.out

If the server can't be found, the error message will be sent to err.out
[These 1's are wreaking havoc on my scripts]

How so?  What kind of scripts are you referring to?
ASKER CERTIFIED SOLUTION
Avatar of knightEknight
knightEknight
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of Locutus_NYC
Locutus_NYC

ASKER

Sorry all.. turns out it was a permissions issue on the share where the script was kept... which was causing the errors.  I assumed it was due to the 1's being present in the output... but once the perms were fixed, the 1's didn't matter.

Again, sorry for the dumb moment.. and thanks for your help.