Re: Batch file help
- From: "Pegasus \(MVP\)" <I.can@xxxxxxx>
- Date: Tue, 21 Nov 2006 15:18:39 +1100
"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
)
.
- Follow-Ups:
- Re: Batch file help
- From: MSBhhNish
- Re: Batch file help
- References:
- Batch file help
- From: MSBhhNish
- Batch file help
- Prev by Date: Re: One monitor for 'Two' Computers?
- Next by Date: Re: new phishing filter update
- Previous by thread: Batch file help
- Next by thread: Re: Batch file help
- Index(es):
Relevant Pages
|
Loading