≡ Menu
Deep in the Code

Moving Multiple Scheduled Tasks into a Folder on Windows Server 2008

Let’s say you have a whole lot of scheduled tasks you want moved into a subfolder in the Task Scheduler.  Since you can’t just drag and drop the tasks, and must export the jobs into XML files to be imported, we will use similar commands as yesterday’s post.

For this, you will need an empty folder.  I use C:temp for this example.  If your folder does not already exist, create one.  Also, you will need a folder in the Task Scheduler GUI to exist.  Create it using the Task Scheduler GUI.

Export all jobs you want to move into XML files:

1. Open the Command Prompt, and change to the C:WindowsTasks folder.

2. Type the following command and press Enter: FOR /R . %F in (*.job) do schtasks /Query /TN “%~nF” /XML > “C:temp%~nF.xml”

This will create all XML files in the C:temp folder.  You can then delete from that folder any XMLs for jobs that you don’t want moved.

Next, delete the jobs in the original folder either using the command line or through the GUI.

Lastly, enter the following command and press Enter:

FOR /R c:temp %F in (*.xml) do schtasks /Create /S <<server name>> /RU <<username>> /RP <<password>> /XML “c:temp%~nF.xml” /TN “<<Task Scheduler folder name>>%~nF”

This will recreate the job files and put the tasks into the folder (in the GUI) of your choosing.