Xcopy behavior questions

M

Matthias Tacke

David Candy said:
I used Dos 5 (built into XP) to echo an errorlevel. Didn't work, which
is why most of my files use this If errorlevel 6 if not errorlevel 7
Echo The error level was 6

- there is *no* dos inside xp.
- you may have used command.com which exists for compatibility reasons
or have disableextensions see "setlocal /?"
- cmd.exe and command.com are shells, no OS.
- the *standard* shell in nt/w2k/xp and newer is cmd.exe, see %comspec%.

Sorry for my harsh reaction, but the informations is there even if
sometimes hard to find - follow my signature.
 
D

David Candy

I must have the good XP. Like 2000 and NT4 it has Dos 5 builtin to ntvdm. Dos 5 (5.00.500 the .500 is the NT specific version of Dos 5).

To force Dos 5 behaviour you must pass commands as parameters to command.com
command /k ver
This applies to batch and typed commands. The .500 command.com is modified to pass all things typed to cmd.exe for execution.
 
A

Al Dunbar [MS-MVP]

Kudos to Matthias for his admirable restraint.

David: you somehow keep failing to realize that Stephen's question and
Matthias' comments are all about the %errorlevel% pseudo-environment
variable that is available in the native command shell of all NT flavours of
windows (cmd.exe), and not the IF ERRORLEVEL construct. Nobody here wants to
force DOS behaviour, rather, Stephen was wanting to clarify that the
%errorlevel% pseudo-environment variable functionality is NOT available in
windows 98.

/Al

I must have the good XP. Like 2000 and NT4 it has Dos 5 builtin to ntvdm.
Dos 5 (5.00.500 the .500 is the NT specific version of Dos 5).

To force Dos 5 behaviour you must pass commands as parameters to command.com
command /k ver
This applies to batch and typed commands. The .500 command.com is modified
to pass all things typed to cmd.exe for execution.
 
A

Al Dunbar [MS-MVP]

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.

===> Since it would seem to divert from reality when the command is run on
an NT box (apparently, I have not tried it), one would have to come to the
conclusion that the DOS 6.22 help file might not contain the definitive exit
error code list for operating system versions that had not yet been
invented, *OR* that it simply applies only to dos 6.22.

/Al

--
----------------------------------------------------------
http://www.g2mil.com/Dec2003.htm
Michael D. Ober said:
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 said:
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:
:: :::
::: 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
 
D

David Candy

XCopy is one of the rare ones in the XP help file. It's identical to Dos.

--
----------------------------------------------------------
And the band played ....
http://www.livejournal.com/users/aldon/74121.html
Al Dunbar said:
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.

===> Since it would seem to divert from reality when the command is run on
an NT box (apparently, I have not tried it), one would have to come to the
conclusion that the DOS 6.22 help file might not contain the definitive exit
error code list for operating system versions that had not yet been
invented, *OR* that it simply applies only to dos 6.22.

/Al

--
----------------------------------------------------------
http://www.g2mil.com/Dec2003.htm
Michael D. Ober said:
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 said:
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:
:: :::
::: 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
 
D

David Candy

Dos 6.22 XCopy CAN return 1 (it works on XP using setver) but NT's can't using a command line they both understand (I just remembered I have 6.22 installed).

--
----------------------------------------------------------
And the band played ....
http://www.livejournal.com/users/aldon/74121.html
XCopy is one of the rare ones in the XP help file. It's identical to Dos.

--
----------------------------------------------------------
And the band played ....
http://www.livejournal.com/users/aldon/74121.html
Al Dunbar said:
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.

===> Since it would seem to divert from reality when the command is run on
an NT box (apparently, I have not tried it), one would have to come to the
conclusion that the DOS 6.22 help file might not contain the definitive exit
error code list for operating system versions that had not yet been
invented, *OR* that it simply applies only to dos 6.22.

/Al

--
----------------------------------------------------------
http://www.g2mil.com/Dec2003.htm
Michael D. Ober said:
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 said:
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:
:: :::
::: 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
 
D

David Candy

And if people didn't snip posts I may be able to follow. If they used standard indicators ... (>), This is why you don't snip.
 
M

Matthias Tacke

Al Dunbar said:
Kudos to Matthias for his admirable restraint.
Thanks, but everything has an end. How comes I have a strong deja vue
of a person insisting to have the last posting when the correctness of
the viewpoint is at least questionable ?
 
A

Al Dunbar [MS-MVP]

And if people didn't snip posts I may be able to follow. If they used
standard indicators ... (>), This is why you don't snip.

===> Some also say that top-posting makes it harder to follow a
conversation. Why do you do *that*?

/Al
 
A

Al Dunbar [MS-MVP]

XCopy is one of the rare ones in the XP help file. It's identical to Dos.


===> But, my friend, if it is identical, then why does it behave
differently? Could it be because it is not identical? You do the math.

===> On my XP box, the help info about that actual native XP xcopy command
displayed by the "XCOPY /?" command says nothing about exit codes. When I
make no assumptions as to what exit codes it might produce, my experience is
more consistent with what happens than yours. Now, I may not be "morally
right" in that one could argue that it would be nice to have meaningful exit
codes to deal with. But given that it apparently does not do the "logical
thing" (hey, that's no novelty here), continuing to expect it will only give
you frustration.


/Al


--
----------------------------------------------------------
And the band played ....
http://www.livejournal.com/users/aldon/74121.html
Al Dunbar said:
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.

===> Since it would seem to divert from reality when the command is run on
an NT box (apparently, I have not tried it), one would have to come to the
conclusion that the DOS 6.22 help file might not contain the definitive exit
error code list for operating system versions that had not yet been
invented, *OR* that it simply applies only to dos 6.22.

/Al

--
----------------------------------------------------------
http://www.g2mil.com/Dec2003.htm
Michael D. Ober said:
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 said:
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:
:: :::
::: 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
 
A

Al Dunbar [MS-MVP]

Dos 6.22 XCopy CAN return 1 (it works on XP using setver) but NT's can't
using a command line they both understand (I just remembered I have 6.22
installed).

===> As I have tried to say, if the behaviour of XP's xcopy command does not
match the documentation you are relying on, then perhaps there is a problem
with the documentation, or that it does not apply in this context. You might
deduce it is the fault of the software rather than the documentation, but
the net effect of either conclusion is the same, and the software will
continue to behave as it behaves. If you don't like it, don't use it, or
adapt your use to its features/shortcomings.


/Al

--
----------------------------------------------------------
And the band played ....
http://www.livejournal.com/users/aldon/74121.html
XCopy is one of the rare ones in the XP help file. It's identical to Dos.

--
----------------------------------------------------------
And the band played ....
http://www.livejournal.com/users/aldon/74121.html
Al Dunbar said:
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.

===> Since it would seem to divert from reality when the command is run on
an NT box (apparently, I have not tried it), one would have to come to the
conclusion that the DOS 6.22 help file might not contain the definitive exit
error code list for operating system versions that had not yet been
invented, *OR* that it simply applies only to dos 6.22.

/Al

--
----------------------------------------------------------
http://www.g2mil.com/Dec2003.htm
Michael D. Ober said:
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 said:
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:
:: :::
::: 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
 
D

David Candy

Shove it up your arse. I don't f*ckin use xcopy or batch files. I ONLY write for others. If I want to copy files I drag them. I schedule nothing. I disk cleanup by hand. I customise sendto and context menus only. I write server scripts (for others) only in vbs. There just aren't enough people wanting picture renaming bat files in windowsxp.photoes.

So the point is I tested the behaviour as it was throwing a invalid drive spec error, maybe the programmers regard the absence of a file matching the filename pattern as a invalid drive spec. So I tested the conditional copies and they threw 0.

--
----------------------------------------------------------
And the band played ....
http://www.livejournal.com/users/aldon/74121.html
Al Dunbar said:
Dos 6.22 XCopy CAN return 1 (it works on XP using setver) but NT's can't
using a command line they both understand (I just remembered I have 6.22
installed).

===> As I have tried to say, if the behaviour of XP's xcopy command does not
match the documentation you are relying on, then perhaps there is a problem
with the documentation, or that it does not apply in this context. You might
deduce it is the fault of the software rather than the documentation, but
the net effect of either conclusion is the same, and the software will
continue to behave as it behaves. If you don't like it, don't use it, or
adapt your use to its features/shortcomings.


/Al

--
----------------------------------------------------------
And the band played ....
http://www.livejournal.com/users/aldon/74121.html
XCopy is one of the rare ones in the XP help file. It's identical to Dos.

--
----------------------------------------------------------
And the band played ....
http://www.livejournal.com/users/aldon/74121.html
Al Dunbar said:
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.

===> Since it would seem to divert from reality when the command is run on
an NT box (apparently, I have not tried it), one would have to come to the
conclusion that the DOS 6.22 help file might not contain the definitive exit
error code list for operating system versions that had not yet been
invented, *OR* that it simply applies only to dos 6.22.

/Al

--
----------------------------------------------------------
http://www.g2mil.com/Dec2003.htm
Michael D. Ober said:
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.

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:
:: :::
::: 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
 
A

Al Dunbar [MS-MVP]

Cause I'm not a wanker like you, dickwad.


==> I held off on a suggestion I was considering in my last reply out of
politeness. In response to the above, here it is:

===> The rest of us have had no trouble following the conversation,
regardless of any snippage, even those of us for whom English is not our
first language. Try reading for content.

===> To that I would add: if you are unable to post with the typical level
of politeness found in these newsgroups, consider going elsewhere.


/Al


--
----------------------------------------------------------
And the band played ....
http://www.livejournal.com/users/aldon/74121.html
Al Dunbar said:
And if people didn't snip posts I may be able to follow. If they used
standard indicators ... (>), This is why you don't snip.

===> Some also say that top-posting makes it harder to follow a
conversation. Why do you do *that*?

/Al

--
----------------------------------------------------------
And the band played ....
http://www.livejournal.com/users/aldon/74121.html
Al Dunbar said:
Kudos to Matthias for his admirable restraint.

David: you somehow keep failing to realize that Stephen's question and
Matthias' comments are all about the %errorlevel% pseudo-environment
variable that is available in the native command shell of all NT
flavours
of
windows (cmd.exe), and not the IF ERRORLEVEL construct. Nobody here
wants
 
D

David Candy

As you are really stupid.

Click Start, Click Help & Support, type "xcopy" in the search box, click the green arrow next to it. Find XCopy in the list and scroll to the bottom of the page.

--
----------------------------------------------------------
And the band played ....
http://www.livejournal.com/users/aldon/74121.html
Al Dunbar said:
XCopy is one of the rare ones in the XP help file. It's identical to Dos.


===> But, my friend, if it is identical, then why does it behave
differently? Could it be because it is not identical? You do the math.

===> On my XP box, the help info about that actual native XP xcopy command
displayed by the "XCOPY /?" command says nothing about exit codes. When I
make no assumptions as to what exit codes it might produce, my experience is
more consistent with what happens than yours. Now, I may not be "morally
right" in that one could argue that it would be nice to have meaningful exit
codes to deal with. But given that it apparently does not do the "logical
thing" (hey, that's no novelty here), continuing to expect it will only give
you frustration.


/Al


--
----------------------------------------------------------
And the band played ....
http://www.livejournal.com/users/aldon/74121.html
Al Dunbar said:
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.

===> Since it would seem to divert from reality when the command is run on
an NT box (apparently, I have not tried it), one would have to come to the
conclusion that the DOS 6.22 help file might not contain the definitive exit
error code list for operating system versions that had not yet been
invented, *OR* that it simply applies only to dos 6.22.

/Al

--
----------------------------------------------------------
http://www.g2mil.com/Dec2003.htm
Michael D. Ober said:
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.

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:
:: :::
::: 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
 
D

David Candy

Some of us only hold 24 hours of messages. I've been here far longer than you and I'll still be here when you've gone.

So I'll make it simple enough for a moron (the M from MVP?). F*ck with me and you'll leave sooner rather than later.
 
A

Al Dunbar [MS-MVP]

Shove it up your arse. I don't f*ckin use xcopy or batch files.

===> I hope you are enjoying this. I'm not, as I don't like to see someone
demonstrate his lack of tact so publicly.

I ONLY write for others.

===> for whom are you writing this?

If I want to copy files I drag them. I schedule nothing. I disk cleanup by
hand. I customise sendto and context menus only. I write server scripts (for
others) only in vbs. There just aren't enough people wanting picture
renaming bat files in windowsxp.photoes.

===> Kind of begs the question why you bothered to reply at all in this
thread if you think so lowly of those that do things differently.

/Al

So the point is I tested the behaviour as it was throwing a invalid drive
spec error, maybe the programmers regard the absence of a file matching the
filename pattern as a invalid drive spec. So I tested the conditional copies
and they threw 0.

--
----------------------------------------------------------
And the band played ....
http://www.livejournal.com/users/aldon/74121.html
Al Dunbar said:
Dos 6.22 XCopy CAN return 1 (it works on XP using setver) but NT's can't
using a command line they both understand (I just remembered I have 6.22
installed).

===> As I have tried to say, if the behaviour of XP's xcopy command does not
match the documentation you are relying on, then perhaps there is a problem
with the documentation, or that it does not apply in this context. You might
deduce it is the fault of the software rather than the documentation, but
the net effect of either conclusion is the same, and the software will
continue to behave as it behaves. If you don't like it, don't use it, or
adapt your use to its features/shortcomings.


/Al

--
----------------------------------------------------------
And the band played ....
http://www.livejournal.com/users/aldon/74121.html
XCopy is one of the rare ones in the XP help file. It's identical to Dos.

--
----------------------------------------------------------
And the band played ....
http://www.livejournal.com/users/aldon/74121.html
Al Dunbar said:
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.

===> Since it would seem to divert from reality when the command is run on
an NT box (apparently, I have not tried it), one would have to come to the
conclusion that the DOS 6.22 help file might not contain the definitive exit
error code list for operating system versions that had not yet been
invented, *OR* that it simply applies only to dos 6.22.

/Al

--
----------------------------------------------------------
http://www.g2mil.com/Dec2003.htm
Michael D. Ober said:
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.

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:
:: :::
::: 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
 
A

Al Dunbar [MS-MVP]

As you are really stupid.

Click Start, Click Help & Support, type "xcopy" in the search box, click the
green arrow next to it. Find XCopy in the list and scroll to the bottom of
the page.

===> Well, way cool. I keep forgetting about *that* documentation - thanks
for reminding me. I guess when one finds the "/?" documentation and
experience sufficient, one is less likely to look for help from the gui side
of things. My bad.

===> On the other hand, if the doc and the behaviour disagree, what I said
before still goes; code so it works in reality, not so it would work if the
docs were perfect.

===> as to being really stupid, if that means that I can learn from my
mistakes and also admit them in public, I guess that that is a label I can
live with. Maybe one day I will call you stupid. But not just yet.

/Al

--
----------------------------------------------------------
And the band played ....
http://www.livejournal.com/users/aldon/74121.html
Al Dunbar said:
XCopy is one of the rare ones in the XP help file. It's identical to Dos.


===> But, my friend, if it is identical, then why does it behave
differently? Could it be because it is not identical? You do the math.

===> On my XP box, the help info about that actual native XP xcopy command
displayed by the "XCOPY /?" command says nothing about exit codes. When I
make no assumptions as to what exit codes it might produce, my experience is
more consistent with what happens than yours. Now, I may not be "morally
right" in that one could argue that it would be nice to have meaningful exit
codes to deal with. But given that it apparently does not do the "logical
thing" (hey, that's no novelty here), continuing to expect it will only give
you frustration.


/Al


--
----------------------------------------------------------
And the band played ....
http://www.livejournal.com/users/aldon/74121.html
Al Dunbar said:
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.

===> Since it would seem to divert from reality when the command is run on
an NT box (apparently, I have not tried it), one would have to come to the
conclusion that the DOS 6.22 help file might not contain the definitive exit
error code list for operating system versions that had not yet been
invented, *OR* that it simply applies only to dos 6.22.

/Al

--
----------------------------------------------------------
http://www.g2mil.com/Dec2003.htm
Michael D. Ober said:
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.

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:
:: :::
::: 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
 
M

Mark V

In microsoft.public.win2000.cmdprompt.admin Al Dunbar [MS-MVP]
wrote:
Cause I'm not a wanker like you, dickwad.


==> I held off on a suggestion I was considering in my last reply
out of politeness. In response to the above, here it is:

===> The rest of us have had no trouble following the
conversation, regardless of any snippage, even those of us for
whom English is not our first language. Try reading for content.

I'm certainly having no problem following the conversation, only the
logic of one of the posters. :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top