How to Import a Scheduled Task from an Xml File?

I have created a scheduled task in Windows 7, which will run a batch file once a day. The task is running perfectly well on my computer.

I have also exported the task to an XML file and want to create the same task on another computer. How can I import the XML file in Task Scheduler on the second computer?

Specifically – I don't want to write any code on new computer, I just want to copy the XML file to it and it should create a task and start running it.

3

1 Answer

When you open Task Scheduler on the new computer, click on "Import Task..." in the Actions list on the right-hand side of the window:

Select the XML file and click "Open", then review the parameters in the "Create Task" window that opens, and click "OK".


If you need to do this programmatically, you can use schtasks.exe. The following code should import the XML file and create a new task automatically:

schtasks.exe /Create /XML task.xml /tn taskname

Just replace "task.xml" with the path to your XML file, after it's been copied to the correct location, and replace "taskname" with whatever name you want it to appear as in Task Scheduler.

8

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Sarah Jenkins

Sarah Jenkins

Senior Technology Editor & AI Specialist

Sarah Jenkins is a veteran tech journalist with over 12 years of experience covering artificial intelligence, mobile innovations, and digital ethics. Her insights have appeared in leading technology publications worldwide.

Share this article
Twitter Facebook Pinterest