简体   繁体   中英

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

Fairly simple line in my Powershell script to run an install. The line works- the installer comes up and completed successfully. Yet this error persists.

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

The error:

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

Even though it works it's important not to have errors in my console not only for obvious reasons but also for approval.

I fixed it by simplifying the command to:

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

That's all it took. Installs, waits, and no error.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM