I am trying to use SCHTASKS to create a scheduled task on Windows. Options include single quotes. If I create my task manually, it will work. In the Windows Task Scheduler GUI, the Details (on the action tab) are displayed as follows:
powershell (New-Object System.Net.WebClient).DownloadString ('http://mywebserver/myscript.ps1\') | powershell.exe -noprofile -
However, when I enter the SCHTASKS command ...
schtasks.exe /Create /TN "My Task" /TR "powershell (New-Object System.Net.WebClient).DownloadString ('http://mywebserver/myscript.ps1\') | powershell.exe -noprofile -" /SC MINUTE /mo 60 /RL HIGHEST
Then it appears in the graphical interface (pay attention to the interpretation of one quotation to double in the first, but not in the second.
powershell (New-Object System.Net.WebClient).DownloadString ("http://mywebserver/myscript.ps1\') | powershell.exe -noprofile -
I tried to elude him, etc. (which works great for double quotes, but not for one), but doesn't seem to be able to figure this out.?!
Thanks so much for any suggestions.