强制 Windows 批处理脚本返回代码 0
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4726580/
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
Force Windows Batch Script Return Code 0
提问by andyhky
A vendor has provided us with a Windows Batch script that needs to have a return code of 0.
供应商为我们提供了一个需要返回代码为 0 的 Windows Batch 脚本。
Per that vendor, there are safe to ignore messages being printed by the script.
根据该供应商,可以安全地忽略脚本打印的消息。
The scripts are used for quiescing the application for a proper backup. Our backup software requires a return code of 0.
这些脚本用于停止应用程序以进行适当的备份。我们的备份软件要求返回码为 0。
How can I do this?
我怎样才能做到这一点?
回答by user1686
End the script with:
用以下命令结束脚本:
exit /b 0
回答by Andy Morris
adding a line to the end of the script
在脚本末尾添加一行
Ver > nul
should do the trick
应该做的伎俩