Re: Xcopy behavior questions
From: David Candy (david_at_mvps.org)
Date: 04/27/04
- Next message: wadester: "Re: findstr, for, or other command to do this?"
- Previous message: Matthias Tacke: "Re: Line continuation if for...do scripts"
- In reply to: Michael D. Ober: "Re: Xcopy behavior questions"
- Next in thread: wadester: "Re: Xcopy behavior questions"
- Reply: wadester: "Re: Xcopy behavior questions"
- Reply: Al Dunbar [MS-MVP]: "Re: Xcopy behavior questions"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 28 Apr 2004 06:15:06 +1000
The following list shows each exit code and a brief description of its
meaning:
0
Files were copied without error.
1
No files were found to copy.
2
The user pressed CTRL+C to terminate XCOPY.
4
Initialization error occurred. There is not enough memory or disk space,
or you entered an invalid drive name or invalid syntax on the command
line.
5
Disk write error occurred.
from Dos 6.22 help file which is the best reference for exit codes.
-- ---------------------------------------------------------- http://www.g2mil.com/Dec2003.htm "Michael D. Ober" <obermd-.@.-alum-mit-edu-nospam> wrote in message news:eOBwAAJLEHA.3904@TK2MSFTNGP09.phx.gbl... > I used %errorlevel% in MS-DOS 5. You have to check your errorlevels in > descending order as the example below shows. That said, there may be a bug > in XCOPY. Also, MS never really documented the error levels returned by > their utilities. > > Mike Ober. > > "Stephen Quist" <quists@spamfree.msei-co.com> wrote in message > news:%23R$d7wILEHA.2260@TK2MSFTNGP09.phx.gbl... > > Thanks for the suggestions. > > > > Is it true that the %errorlevel% usage is an NT improvement that is not > > available under Win98? > > > > Apparently, despite the clear statement in the help for Xcopy, > > it never, under any circumstances, returns an errorlevel of 1. > > Pity. I, for one, would find it useful. > > > > Steve > > > > > > > > Al Dunbar [MS-MVP] wrote: > > :: "Stephen Quist" <quists@spamfree.msei-co.com> wrote in message > > :: news:%23J1GFLaIEHA.3144@TK2MSFTNGP10.phx.gbl... > > ::: > > ::: Major Ninth wrote: > > ::::: did you use ERRORLEVEL or %ERRORLEVEL% ? > > ::::: -john > > ::::: > > ::: I used the standard syntax. > > :: > > :: Seems like standard DOS-based batch syntax - see suggestions below... > > :: > > ::: I've tried it with nonexistent directories > > ::: and empty directories. None of my tests gave me an errorlevel of 1. > > ::: Here's my test file: > > ::: > > ::: @setlocal > > ::: if %1. == . goto needdir > > :: > > :: or: > > :: > > :: if "%1" EQU "" goto:needdir > > :: > > ::: @if exist i:\not_now.text goto notnow > > ::: > > ::: xcopy i:\esprel %1 /r /c /l /d /exclude:i:\esprel\excludelist.txt > > ::: temp.txt > > :: > > :: or replace these lines: > > :: > > ::: @if errorlevel 5 goto e5 > > ::: @if errorlevel 4 goto e4 > > ::: @if errorlevel 2 goto e2 > > ::: @if errorlevel 1 goto e1 > > ::: @if errorlevel 0 goto e0 > > :::: e5 > > ::: @echo errorlevel 5 > > ::: @goto end > > :::: e4 > > ::: @echo errorlevel 4 > > ::: @goto end > > :::: e2 > > ::: @echo errorlevel 2 > > ::: @goto end > > :::: e1 > > ::: @echo errorlevel 1 > > ::: @goto end > > :::: e0 > > ::: @echo errorlevel 0 > > ::: @goto end > > :: > > :: with these lines: > > :: > > :: @echo errorlevel is %errorlevel% > > :: @goto:eof > > :: > > ::: > > ::: > > :::: needdir > > ::: @echo off > > ::: @echo test message > > ::: @goto end > > ::: > > :::: notnow > > ::: @type i:\not_now.text > > ::: > > :::: end > > :: > > :: Don't need a :end label, as :eof is implicitly there. > > :: > > :: /Al > > > > > >
- Next message: wadester: "Re: findstr, for, or other command to do this?"
- Previous message: Matthias Tacke: "Re: Line continuation if for...do scripts"
- In reply to: Michael D. Ober: "Re: Xcopy behavior questions"
- Next in thread: wadester: "Re: Xcopy behavior questions"
- Reply: wadester: "Re: Xcopy behavior questions"
- Reply: Al Dunbar [MS-MVP]: "Re: Xcopy behavior questions"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|