How to make batch file continue running when the triggered exe crashes

我是研究僧i 提交于 2019-12-08 10:23:30

问题


I have a batch script that triggers an exe (c++ code) with command line input in a loop.

The code for this is something like this:

for /f %%j in (file.txt) do (
"MyExe.exe" "input\MyInput_%%j.txt"
)

"file.txt" contains list of input file names. The problem is, sometimes my exe crashes for some input files. When it crashes, script stops running and it requires manual intervention.

How can this be corrected so that when ever exe crashes, my script could just display a message and continues executing with next input?

I am running the script on windows XP but a OS free solution would be better.


回答1:


Try running it within another instance. Something like this:

for /f %%j in (file.txt) do (
    cmd.exe /C "MyExe.exe" "input\MyInput_%%j.txt"
)


来源:https://stackoverflow.com/questions/9324461/how-to-make-batch-file-continue-running-when-the-triggered-exe-crashes

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!