Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

copy errorlevel

3,366 views
Skip to first unread message

Joachim Hofmann

unread,
Feb 1, 2011, 6:27:38 AM2/1/11
to
Hello,

where can I find a list of Windows XP copy errorlevels
(e.g. "not enough disk space")

Thank You
Joachim

foxidrive

unread,
Feb 1, 2011, 6:38:32 AM2/1/11
to
On 1/02/2011 22:27, Joachim Hofmann wrote:

> where can I find a list of Windows XP copy errorlevels
> (e.g. "not enough disk space")


You want the error messages?


If you describe why you need them then someone might come up with an
idea that helps you.

--
Regards,
Mic

Joachim Hofmann

unread,
Feb 1, 2011, 8:11:31 AM2/1/11
to
foxidrive schrieb:

I d need something like

copy a b
if errorlevel 5 do delete_old_files_cause_of_little_space
copy a b_new attempt

or should I catch the literal errror message instead?
This would be "Es steht nicht genug Speicherplatz auf dem Datenträger zur Verfügung."

- Joachim


John Gray

unread,
Feb 1, 2011, 8:26:55 AM2/1/11
to

Unless I'm mistaken, the COPY command doesn't return an errorlevel
other than 0.

XCOPY does, though, and so is to be preferred.
0 - All files were copied without errors
1 - No files were found to copy (invalid source)
2 - XCOPY was terminated by Ctrl-C before copying was complete
4 - An initialization error occurred.
Such an error would generally caused by insufficient memory or disk
space, or invalid drive name (invalid target) or syntax.
5 - A disk-write error occurred.

To really do the job properly, might I suggest ROBOCOPY?

foxidrive

unread,
Feb 1, 2011, 8:30:13 AM2/1/11
to

Xcopy errorlevels are documented. I couldn't find copy errorlevels in a
quick search but xcopy will do the same thing.


http://technet.microsoft.com/en-us/library/bb491035.aspx

--
Regards,
Mic

foxidrive

unread,
Feb 1, 2011, 9:55:16 AM2/1/11
to
On 2/02/2011 00:26, John Gray wrote:

> Unless I'm mistaken, the COPY command doesn't return an errorlevel
> other than 0.

It does return an errorlevel on failure in XP SP3 at least.

D:\>echo %errorlevel%
0

D:\>copy boot.ini a.ini
1 file(s) copied.

D:\>echo %errorlevel%
0

D:\>copy oot.ini b.ini
The system cannot find the file specified.

D:\>echo %errorlevel%
1

--
Regards,
Mic

01MDM

unread,
Feb 1, 2011, 10:05:06 AM2/1/11
to

COPY.EXE returning only success or failure. 0 or 1

Andy

unread,
Feb 1, 2011, 1:37:38 PM2/1/11
to

Your batch also works fine with XP Home Edition 2nd edition.

Andy

Andy

unread,
Feb 1, 2011, 1:51:05 PM2/1/11
to

Looks like you can get more errorlevels with xcopy.

xcopy /r/y l:\test.zzz z.abc
echo %errorlevel%

C:\Backup>xcopy /r/y l:\test.zzz z.abc
Invalid drive specification
0 File(s) copied

C:\Backup>echo 4
4
C:\Backup>

01MDM

unread,
Feb 1, 2011, 4:39:17 PM2/1/11
to
> COPY.EXE returning only success or failure. 0 or 1

s/COPY.EXE/COPY

Dr J R Stockton

unread,
Feb 2, 2011, 3:26:36 PM2/2/11
to
In alt.msdos.batch.nt message <8qq91a...@mid.individual.net>, Tue, 1
Feb 2011 12:27:38, Joachim Hofmann <spei...@freenet.de> posted:

>where can I find a list of Windows XP copy errorlevels
>(e.g. "not enough disk space")

Google for list of errorlevels and the first of the 416000000
results is not far from what you want - just read on ...

Google Advanced Search for list of Windows XP copy errorlevels
within the past year jives just 2320000 to read through. including
<http://en.wikipedia.org/wiki/COMMAND.COM> with useful links. And for
list of CMD.EXE errorlevels just 202.

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 MIME.
Web <http://www.merlyn.demon.co.uk/> - FAQish topics, acronyms, & links.
Proper <= 4-line sig. separator as above, a line exactly "-- " (SonOfRFC1036)
Do not Mail News to me. Before a reply, quote with ">" or "> " (SonOfRFC1036)

0 new messages