SchTasks.exe to create a task folder

G33kKahuna picture G33kKahuna · Mar 20, 2012 · Viewed 21.1k times · Source

Is there a command to create a Schedule task folder in Windows 2008? I am trying to use SchTasks.exe to create the tasks and would like to put these tasks under a task folder. Essentially, inside task scheduler, add a new folder and add multiple tasks underneath the folder. From UI there is an option to create a folder but not sure about command reference

Thanks in advance

Answer

G33kKahuna picture G33kKahuna · Mar 22, 2012

few trials and solved the problem; the key is using "\" in the task name. Sample schtask.exe command line,

schtasks /create /xml "MyTask.xml" /tn "My Task Folder\My New Task"

creates a new task folder My Task Folder and creates a new task My New Task under the new folder

If the task needs to get created under an existing folder, try

schtasks /create /xml "MyTask.xml" /tn "Existing Task Folder\My New Task"

creates a new task My New Task under an existing task folder Existing Task Folder