Running an executable from PowerShell does not work with spaces in the path
- by John Hartley
From the PowerShell prompt:
\Windows\system32\mspaint.exe
will run Paint. So will
Invoke-Expression -command "\Windows\system32\mspaint.exe"
but if there is a space in the path PowerShell spits the dummy e.g.
Invoke-Expression -command "\install\sub directory\test.bat"
Which complains:
The term '\install\sub' is not recognized as the name of a cmdlet, function, script file, or operable program.
What am I missing?