Powershell 抛出“无法验证参数参数”错误但仍然有效?

Powershell Throws “Cannot Validate The Argument on Parameter” Error But Still Works?

我的 Powershell 脚本中相当简单的一行 运行 安装。该线路有效 - 安装程序出现并成功完成。然而这个错误仍然存​​在。

Start-Process -Wait (msiexec.exe /I “C:\Temp\MBAM 2.5\Installers\x64\MBAMClient.msi”)

错误:

Start-Process : A positional parameter cannot be found that accepts argument ‘C:\Temp\MBAM 2.5\Installers\x64\MBAMClient.msi’
At line:1 char:1

即使它有效,重要的是不要在我的控制台中出现错误,这不仅是出于显而易见的原因,也是为了获得批准。

我通过将命令简化为以下方式修复了它:

‘Start-Process -Wait ‘C:\Temp\MBAM 2.5\Installers\x64\MBAMClient.msi’‘

仅此而已。安装,等待,没有错误。