I'm running Windows 10, Powershell Version 5.1. I was having the same issue with spaces in the file path when attempting to execute PS1 scripts. In my case, I had one script that was calling another in the same folder. The purpose of the first script is to elevate the second script to admin privileges. The spaces were in the user's name on the computer, so that their desktop was something like "C:\Users\User Space Name\Desktop". I tried every suggestion across the internet, including the suggestions here and on other StackOverflow posts. NONE worked. I could get the scripts to run if I opened Powershell first, but I could not get them to run by double-clicking the file. I would always get errors in the form of "The term 'C:\Users\User' is not a recognized cmdlet..."
I found out that if you edit the registry entry for the file extension association to powershell, it will start working. The registry entry is as follows:
HKEY_CLASSES_ROOT\Applications\powershell.exe\shell\open\command
Default Value: "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" "%1"
New Value: "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" "& "%1""
I'm not sure why this works but it does.