scheduled tasks - How to properly quote file path with SCHTASKS -


i'm writing small app generates contents of batch file, using schtasks create scheduled tasks. however, cannot file path working correctly. need set of eyes.

schtasks /create /tn "task1" /tr "\"c:\program_files\spybot - search & destroy\spybotsd.exe\" \autocheck \autofix \autoclose" /st 01:00:00 /sc daily /ru myuser /rp mypass  

i've looked @ other threads here, , ms documentation, , think have formed correctly. however, fails output:

error: invalid syntax. mandatory option '/sc' missing.
type "schtasks /create /?" usage.
system cannot find path specified.

i use advice here.

you need escape ampersand caret this:

schtasks /create /tn "task1" /tr "\"c:\program_files\spybot - search ^& destroy\spybotsd.exe\" \autocheck \autofix \autoclose" /st 01:00:00 /sc daily /ru myuser /rp mypass   

Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -