CMD命令执行后的返回值并不是想要的值
cmd /k xcopy C:\DD* D:\GG /s /e
if %errorlevel% NEQ 0 (
echo what are you doing now?
)
C:\Users\chipembed\Desktop>cmd /k xcopy C:\DD* D:\GG /s /e
File not found - *
0 File(s) copied
从网上搜索资料得出,%errorlevel%返回的是上一条命令的返回值
试过在上述命令执行完,手动执行以下命令
echo %errorlevel% 得出结果是4,只要是非0,就代表失败
怀疑可能是该批处理指令执行过程中就异常退出,没有继续往下执行
可能需要检查下这条指令内容:xcopy C:\DD* D:\GG /s /e
what are you doing now?