将 ERRORLEVEL 重置为零的最简单方法是什么?
问题描述:
我有一个为 c# 项目运行一些命令的构建后事件.最后一条命令有时会导致 ERRORLEVEL 值不为零,然后构建失败.
I have a post-build event that runs some commands for a c# project. The last command would sometimes cause the ERRORLEVEL value not equals to zero and then the build fails.
我想附加一行额外的命令以始终将 ERRORLEVEL 值设置为零.最方便的方法是什么?
I want to append an extra line of command to always set the ERRORLEVEL value to zero. What is the most convenient way to do that?
答
我发现exit 0"看起来是处理这个问题的好方法.
I found that "exit 0" looks like a good way to deal with this problem.
用法示例:
NET STOP UnderDevService/Y
NET STOP UnderDevService /Y
退出 0
如果未启动 UnderDevService 服务.
if the UnderDevService service is not started.