Re: Batch file help
- From: MSBhhNish <MSBhhNish@xxxxxxxxxx>
- Date: Mon, 20 Nov 2006 21:43:48 -0800
Pegasus (MVP) wrote:
"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
)
The thing is, I don't want to assume that the error will
be "Insufficient space". I want to display whatever is
returned by the copy...
.
- Follow-Ups:
- Re: Batch file help
- From: Pegasus \(MVP\)
- Re: Batch file help
- References:
- Batch file help
- From: MSBhhNish
- Re: Batch file help
- From: Pegasus \(MVP\)
- Batch file help
- Prev by Date: Re: Opening a Command prompt from a Folder in the Explorer
- Next by Date: Disk cleanup question
- Previous by thread: Re: Batch file help
- Next by thread: Re: Batch file help
- Index(es):
Relevant Pages
|
Loading