windows 进程被强制杀死时的进程退出代码
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4344923/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Process Exit Code When Process is Killed Forcibly
提问by Armen Tsirunyan
When we kill a process in Windows with Task Manager End Process command, will the process still return an exit code? And if so, what exit code it returns? Thanks
当我们在 Windows 中使用任务管理器结束进程命令杀死进程时,该进程是否仍会返回退出代码?如果是这样,它返回什么退出代码?谢谢
回答by Simon Mourier
In general, a process is terminated using TerminateProcess. The exit code is passed as a parameter to this method.
通常,使用TerminateProcess 终止进程。退出代码作为参数传递给此方法。
In the case of the task manager, the exit code is set to 1, but I don't know if it's documented anywhere.
在任务管理器的情况下,退出代码设置为 1,但我不知道它是否记录在任何地方。
回答by barti_ddu
Yes, it will return non-zero return code which will be wrapped in %ERRORLEVEL%
variable.
是的,它将返回包含在%ERRORLEVEL%
变量中的非零返回代码。