Windows Powershell doesn't seem to accept target paths with spaces

This worked for me:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy RemoteSigned C:\Program Files\My` Scripts\CenterCursor

Note that you will need a ` after each word (before the space) and you don't need the outer ".

Source


In a more general case, you can use the following syntax to run any PowerShell script with space in the path:

&("C:\any path with spaces in it\")

In your case, that would be:

&("C:\Program Files\My Scripts\CenterCursor")

Edit: this only works if you are using windows powershell

Source


You might be able to cheat by using the short name.

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy RemoteSigned "C:\Progra~1\MyScri~1\CenterCursor"

I guessed your short names based on likelihood, but you can find the real ones using methods from this question like dir /x.