如何使批处理文件继续运行exe文件触发崩溃时 [英] How to make batch file continue running when the triggered exe crashes

查看:166
本文介绍了如何使批处理文件继续运行exe文件触发崩溃时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个批处理脚本,触发器使用命令行输入一个exe(C ++ code)在一个循环中。

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

在code这是这样的:

The code for this is something like this:

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

file.txt的包含输入文件名列表。问题是,有时我对某些输入文件exe文件崩溃。当它崩溃,脚本停止运行,它需要人工干预。

"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.

这怎么可能纠正,以便当过EXE崩溃,我的脚本可以只显示一条消息,并继续与下一个输入执行?

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

我运行Windows XP上的脚本,但一个OS免费的解决方案会更好。

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

推荐答案

尝试另一个实例中运行它。事情是这样的:

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"
)

这篇关于如何使批处理文件继续运行exe文件触发崩溃时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆