Executing a PowerShell script from outside PowerShell (for example via a Windows shortcut) can be a little complicated, especially if the path to the script contains spaces and it has parameters, so here’s how to do it:
powershell.exe -command "& 'C:\A path with spaces\login.ps1' -password XXX"
Note that I’m using the PowerShell & operator to execute the script. This is because I have to surround the path with quotes so that it’s interpreted by PowerShell as a single literal even though it contains spaces. If I would leave out the “&” then the quoted string would simply be interpreted as a string literal to output, so the script would not be executed.
The parameters to the script should not be included within the single quotes since they are not part of the first literal, which should only contain the path to the script to execute.