From within Powershell and Powershell ISE, Powershell scripts that exist in locations with a space in the path do not execute, or at least their output is not shown in the command window.
I have a Powershell script (helloworld.ps1
) that contains only the following code:
Write-Host "Hello World"
If the script is executed from:
"C:\Temp\helloworld.ps1"
The output is: Hello World
If the script is executed from:
"C:\Program Files\Microsoft Office\helloworld.ps1"
The output is blank.
Note that the path is surrounded with quotes when executed (otherwise, obviously, I would have errors). I've duplicated this same problem on multiple machines in multiple environments, so it doesn't seem to be a configuration issue.
For what reason is Powershell output hidden if the script itself is executed from a path that contains a space?