【发布时间】:2016-07-11 09:08:42
【问题描述】:
团队,我写了安装一些软件的程序,然后它在下面显示退出代码。
$SoftwareInstall.ExitCode
它返回 0 和其他值取决于安装的方式。仅当退出代码为 0 的成功时,我才有其他表达式要执行。如何使用 if 条件设置检查。您能否建议以下方法是否正确
if ( $SoftwareInstall.ExitCode -eq 0){
"Software Installed successfully "
#Then some other code I'll put here
}
else{
"Software did not installed"
}
请提出建议。
【问题讨论】:
-
是的,这是正确的方法
-
谢谢!会做的。
标签: windows powershell window powershell-2.0 powershell-3.0