Re: Batch file help




"MSBhhNish" <MSBhhNish@xxxxxxxxxx> wrote in message
news:45627755.70707@xxxxxxxxxxxxx
I have a batch file that I wrote on a Win2K system where
I have something like:
copy file1.txt f:\file2.txt > NUL:
On win2K if I have an error, such as not enough room on f:,
the error message is displayed on the Console window. If
no error, the "1 file(s) copied" message goes out to null.

However on WinXP, both the stdout and stderr message goes
to NUL:. Is there a way to write the copy command so
that it emulates Win2K?

TIA

Try this:
copy file1.txt f:\file2.txt 1> NUL

A far better way would go like so:

@echo off
copy /y file1.txt f:\file2.txt 1>nul 2>nul
if %ErrorLevel% GTR 0 (
echo.
echo Insufficient space on drive F:.
echo Do something about it!
echo.
echo Press the space bar to close this window.
pause > nul
)


.



Relevant Pages

  • Re: Can I add myself to Administrators group of all PCs when I log
    ... @echo Choose the domain for this PC from the menu below... ... if errorlevel = 11 goto CFEWC ... net localgroup administrators "ndhq\baseline managers" /add> nul ...
    (microsoft.public.windows.server.scripting)
  • Re: Batch file help
    ... On win2K if I have an error, such as not enough room on f:, ... to NUL:. ... @echo off ... echo Insufficient space on drive F:. ...
    (microsoft.public.windowsxp.general)
  • Re: Batch file help
    ... copy file1.txt f:\file2.txt 1> NUL ... On win2K if I have an error, such as not enough room on f:, ... @echo off ... echo Insufficient space on drive F:. ...
    (microsoft.public.windowsxp.general)
  • Re: find -print0 confusing me
    ... echo "straight call to find" ... echo "calling in backquotes" ... The NUL byte is the string terminator. ...
    (comp.unix.shell)
  • Re: Batch file help
    ... On win2K if I have an error, such as not enough room on f:, ... to NUL:. ... @echo off ... echo Insufficient space on drive F:. ...
    (microsoft.public.windowsxp.general)

Loading