Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Appcmd 命令在无效时退出并失败,例如尝试添加已经存在的 mime 类型。
有没有办法覆盖现有值或对错误不那么严格?
我的用例是我正在使用 appcmd 部署网站,并且我希望命令能够顺利运行,即使它们之前已经运行过。
假设您正在使用 CMD 批处理文件,您可以追加
2>nul || echo command failed
到你的 appcmd 结尾;我认为,这将产生比常规故障更少的噪音,并且应该让它有一个 0 返回码。但是如果不忽略发生的错误,不,您不能告诉 appcmd 本身“尝试执行此操作,但如果失败则忽略它”。