如何获得一个Java程序在Windows批处理文件的退出状态 [英] How to get the exit status of a Java program in Windows batch file
本文介绍了如何获得一个Java程序在Windows批处理文件的退出状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
类似于 $?
在Linux中,有没有办法让一个程序的退出状态在Windows批处理文件( .BAT
)?
例如说,该方案具有 System.exit(0)
一旦成功执行,以及 System.exit(1)
在一个失败,我怎么陷阱在这些出口值的.bat
文件?
Analogous to the $?
in Linux, is there a way to get the exit status of a program in a Windows batch file (.bat
)?
Say for example the program has a System.exit(0)
upon successful execution, and a System.exit(1)
upon a failure, how do I trap these exit values in a .bat
file?
推荐答案
使用%ERRORLEVEL%。难道你不爱批处理文件是如何明确和简洁的? :)
Use %ERRORLEVEL%. Don't you love how batch files are clear and concise? :)
这篇关于如何获得一个Java程序在Windows批处理文件的退出状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文