i am trying to execute a command xcopy path1 path2 /Y /C and it is getting executed successfully when i tried from command line and also when i copied it to a batch file and double clicking on that batch file.
But it is not getting executed when i cal this batch file from another fail.
Could anyone please help here?
Not working case:
C:abcd>cmd.exe /C "xcopy "C:folder1itsme.bat" "Y:" /C /Y /Z"
0 File(s) copied
Working case:
C:abcd>cmd.exe /C "xcopy "C:folder1itsme.bat" "Y:" /C /Y /Z"
C:abcditsme.bat
1 File(s) copied
Extra Info:
Runme.bat:
call C:folder1copy.bat
call C:folder1clean.bat
copy.bat:
@echo off
xcopy "C:folder1
unrun.bat" "Z:" /C /Y /Z /Q
xcopy "C:folder1
unrun.bat" "Y:" /C /Y /Z /Q
xcopy "C:folder1
unrun.bat" "X:" /C /Y /Z /Q
Here, If I double click on Runme.bat, copy.bat is getting executed and copying all the files.
1 File(s) copied
1 File(s) copied
1 File(s) copied
But issue is, it is not copying anything when i try to run the same batch file from windows scheduler.
Output:
0 File(s) copied
0 File(s) copied
0 File(s) copied
looks like issue is only with copy command in the second batch file, which will return output. But all the commands in the other batch file clean.bat (which i am calling from the first batch file) are getting executed without any issues.
second batch file has simple echo commands, so that is why it is working fine.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…