Why can't you do it? XCopy has no requirements like this.
--
Indeed.
But this might happen if XCOPY.EXE is in the %USERPROFILE% directory but not
on the path or if there is some other XCOPY executable (like XCOPY.BAT for
instance) in your then-current directory on C:
I suspect you've called your batch file XCOPY.BAT or XCOPY.CMD
If you do this, executing XCOPY within the batch will locate XCOPY.BAT in
the current directory, and run that (which locates XCOPY.BAT in the current
directory .....) rather than running XCOPY.EXE (from the \windows\system32
directory) since the PATH is always implicitly prefixed by the current
directory name.
When you move to a different directory before attempting the XCOPY command,
XCOPY.BAT is no longer in the current directory, so the path is searched and
c:\windows\system32\XCOPY.EXE found
Just rename XCOPY.BAT so that the name part no longer conflicts with inbuilt
commands
HTH
....Bill