Command Prompt executes this correctly but Powershell doesn't?


Having some weirdness where Powershell is not executing this command correctly. It can't understand the INSTALLFOLDER or TARGETDIR and just throws up the Windows Installer help box.

Whereas command prompt processes this just fine??? It's very weird. PS version is 5.1.18362 I believe.

the command is

msiexec.exe /i "C:\Users\sadas\aasasdd\sda\asdasd\19526-Debug-x64.msi" INSTALLFOLDER="C:\Installation Test" /qn

My msi is a Wix installer msi and has the property INSTALLFOLDER


This is not how you run this command in PowerShell. There are several ways to run external command in PowerShell and it a well-documented use case. Links to follow

• Using PowerShell and external commands and their parameters or switches. Running external commands, always require special consideration.

• PowerShell: Running Executables

• Solve Problems with External Command Lines in PowerShell

• Top 5 tips for running external commands in Powershell

• Using Windows PowerShell to run old command-line tools (and their weirdest parameters)

• Execution of external commands in PowerShell done right

• Quoating specifics

PowerShell has a list of characters that mean specific things, vs what cmd.exe implementation means, and if you need those, they must be properly terminated. See the below

About Special Characters

PowerShell - Special Characters And Tokens

So, to make your command work in the PowerShell consolehost, ISE, VSCode, do something like this...

# Using teh Call operator
& 'msiexec.exe /i "C:\Users\sadas\aasasdd\sda\asdasd\19526-Debug-x64.msi" INSTALLFOLDER="C:\Installation Test" /qn'


... this...

# Using Start-Process
$ConsoelCommand = 'msiexec.exe /i "C:\Users\sadas\aasasdd\sda\asdasd\19526-Debug-x64.msi" INSTALLFOLDER="C:\Installation Test" /qn'
Start-Process powershell -ArgumentList "-NoExit","-Command  &{ $ConsoleCommand }" -Wait