检查是否命令是在一个批处理文件全成 [英] check if command was successfull in a batch file
本文介绍了检查是否命令是在一个批处理文件全成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在批处理文件中如何检查是否命令
How within a batch file to check if command
start "" javaw -jar %~p0/example.jar
是成功还是产生了错误?
was successful or produced an error?
我想使用if / else语句来呼应这个信息了。
I want to use if/else statements to echo this info out.
推荐答案
您可以使用
if errorlevel 1 echo Unsuccessful
在某些情况下。这取决于最后一个命令返回正确的退出code。你将不能够告诉大家,有什么不妥,如果你的程序正常返回即使有异常状况。
in some cases. This depends on the last command returning a proper exit code. You won't be able to tell that there is anything wrong if your program returns normally even if there was an abnormal condition.
这篇关于检查是否命令是在一个批处理文件全成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文