cmd is for running a new instance of the
command line interpreter and need to be used usually only for opening a
command prompt window. Execute in a command prompt window
/? to get help about this command.
cmd does not need to be used usually if a
command prompt window is opened already and a command is entered. A batch
file is interpreted by
cmd and therefore it does not make
sense to use
cmd in a batch file.
So use only
xcopy "C:folder1itsme.bat" "Y:" /C /Y /Z in
already opened command prompt window and in the batch file.
To run another batch file (batch file 2) from within a batch file (batch
file 1) and halt the execution of batch file 1 until the called batch file
2 has finished, use in batch file 1 the command
Example for batch file 1:
echo This is batch 1 calling now batch 2 and is waiting until it finished.
call "batch file 2.bat"
echo Batch 1 continues.
Example for batch file 2:
echo This is batch 2 running XCOPY.
xcopy "C:folder1itsme.bat" "Y:" /C /Y /Z
echo XCOPY finished, batch 2 terminates.
Run batch file 1 and you get the output:
This is batch 1 calling now batch 2 and is waiting until it
This is batch 2 running XCOPY.
XCOPY finished, batch 2 terminates.
Batch 1 continues.
call in batch file 1, execute it again and
look what you get now.
This time batch file 1 starts batch file 2 instead of
calling it which results in immediate continuation of
batch file 1 and batch file 2 is executed parallel (more or less depending
on number of CPU cores and disk usage).