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

powershellwindows

I was following this thread Is there a Win7 shortcut to position mouse in center of primary screen?

Following the suggestion of the guy with 12 upvotes, I created a shortcut with the target file being

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

It just wouldn't work, unless the target file doesn't have any spaces inside the double quote

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy RemoteSigned "C:\Users\TOSHIBA\Desktop\CenterCursor"

It's just a minor issue but is there any way to fix this?

Best Answer

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

Related Question