Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I have a batch file using >Nul to supress the output, however it also needs to write to a new file, however when writing to the second batch file the >Nul does not get written. What is the syntax I should using? I currently have this:
echo <somecommand> >Nul >>%tempfile%
However when looking at the temp file created, it wrote the following:
echo <somecommand>
Any suggestions?

Hi
Use the ^ symbol to stop it being used as a output to a device. ie Nul or FileName.echo Command ^> null ^>^> %tempfile%

Hi,
NUL is not a command. It's a device defined by the OS. It's the 'bit bucket' so when you redirect output to NUL, it just gets thrown away. Ditto for 'copy/b filename nul' ensures that a file can really be read.
One goofy thing about w2k is that there's no NULL; just NUL. I'm almost sure that in DOS 3.x and up it was NULL.
Another goofy: you may recal the device CTTY. It seems to have gone away in w2k.
As for the original issue, I tried this:
@echo off
echo xcopy>thisfileWorks with no use of NUL. Maybe I missed your point.
And while we're almost on the subject, will someone running XP do 'set' and tell me the OS variable?
In w2k it's OS=Windows_NT
Ineed to make a batch file smart enough to run on boxes with/without CHOICE.COM
Hope this Helps.
Peter
Mechanix2Go@Golden-Triangle.com

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |