Re: Batch file help
- From: MSBhhNish <MSBhhNish@xxxxxxxxxx>
- Date: Tue, 21 Nov 2006 06:00:34 -0800
Pegasus (MVP) wrote:
"MSBhhNish" <MSBhhNish@xxxxxxxxxx> wrote in message
news:45629214.1000602@xxxxxxxxxxxxx
Pegasus (MVP) wrote:"MSBhhNish" <MSBhhNish@xxxxxxxxxx> wrote in messageThe thing is, I don't want to assume that the error will
news:45627755.70707@xxxxxxxxxxxxx
I have a batch file that I wrote on a Win2K system whereTry this:
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
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
)
be "Insufficient space". I want to display whatever is
returned by the copy...
Same idea!
@echo off
copy /y file1.txt f:\file2.txt 1>nul 2>nul
if %ErrorLevel% GTR 0 (
echo.
echo Problem copying the file. Do something about it!
echo.
echo Press the space bar to close this window.
pause > nul
)
Your solution is too generic. I hate to give generic
answers to my users. They won't have any idea what the
problem is and they'll just call me.
Does anyone else have a solution to my problem?
.
- Follow-Ups:
- Re: Batch file help
- From: Jon
- Re: Batch file help
- From: 3c273
- Re: Batch file help
- References:
- Batch file help
- From: MSBhhNish
- Re: Batch file help
- From: Pegasus \(MVP\)
- Re: Batch file help
- From: MSBhhNish
- Re: Batch file help
- From: Pegasus \(MVP\)
- Batch file help
- Prev by Date: Re: User account control
- Next by Date: Re: Problem with a shortcut
- Previous by thread: Re: Batch file help
- Next by thread: Re: Batch file help
- Index(es):
Relevant Pages
|
Loading