我有两个批处理文件,task.bat和runtask.bat. runtask.batcalls task.bat我希望runtask.bat将task.bat的退出代码转换为变量.怎么可以这样做?
task.bat:
@echo off set errorlevel=1
runtask.bat
... CMD /C task.bat set taskexitcode=????
只需交换CMD / C进行通话即可.
task.bat:
@echo off set errorlevel=15
runtask.bat
call task.bat set taskexitcode=%errorlevel% echo %taskexitcode%
产量
15