Using ServiceUI with space in folder name

Our deployment system downloads the installation files into a folder in C: \Program Files. Therefore the path to the Deploy-Application.exe file contains spaces, and when I runs it I just got exitcode 0, without it has been run.

How can I start it up with spaces in folder name?

The script i used:

        $Tmp = "-Process:explorer.exe ""$($PSScriptRoot)\Deploy-Application.exe"" ""-DeployMode $($DeployMode) -DeploymentType $($DeploymentType)"""
        $process = Start-Process "$($PSScriptRoot)\AppDeployToolkit\ServiceUI.exe" -PassThru -Wait -ArgumentList "$($Tmp)"

If I copy the installation file to at folder without space in, it works fine.

May be try this…

#$Tmp = "-Process:explorer.exe `"$($PSScriptRoot)\Deploy-Application.exe`" -DeployMode $($DeployMode) -DeploymentType $($DeploymentType)"
#$process = Start-Process -FilePath "$($PSScriptRoot)\AppDeployToolkit\ServiceUI.exe" -PassThru -Wait -ArgumentList "$($Tmp)"
1 Like