Monthly archives: February 2014
There is no end to complicated methods on the internet regarding the proper way to schedule a PowerShell task. You see all manner of command line switches and escape sequences. It's not that complicated! Your task is powershell.exe and your argument is the path to the script. If you need to quote the path because it contains spaces, use a combination of single and double quotes to parameterize the argument and then quote the path within the parameter. When you do this, you also need to remember to precede the inner quote with an ampersand so PowerShell treats it as a script to execute and not just an output string. It sounds more complicated than it actually is.
powershell.exe "& 'c:\my path\with spaces\mycoolscript.ps1'"