Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
Based on the comments to the answer below, it appears that the question is more about how to schedule tasks via programming rather than through the end user interfaces. StackOverflow would be a better place to ask that, since that is a Q&A site for developers. – Thomas Jul 16 '15 at 21:14
up vote 5 down vote accepted

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:

enter image description here

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.

share|improve this answer
I want to eliminate those steps. Let me explain you my query in detail: I am creating windows application using SQL Server Express. I had created backup plan in t-sql, used batch file and task scheduler to do backup once in a day. Our users download application online so there is no other way for us to setup task scheduler manually. I am not sure how to achieve this task. I am reading windows services, C#.NET and so on. Can you guide me in proper context? – Rushabh Shah Oct 9 '12 at 18:53
Does your application have some sort of installer? If so, you can call schtasks.exe /Create /XML task.xml to create the task automatically (see this MSDN article on schtasks.exe for more information). But I don't think there's a way to have the task created simply by copying an XML file somewhere and nothing else. – Indrek Oct 9 '12 at 18:58
i am using install shield for installation of my application – Rushabh Shah Oct 9 '12 at 19:05
I'm not that familiar with InstallShield, but it should allow you to run custom actions, so try running the code I gave you (after having copied the XML file, of course), that should create the scheduled task. – Indrek Oct 9 '12 at 19:07
Ok! I'll work on it and will inform you if it did work or not. Just to inform you, to implement all those stuff into InstallShield will take some times or days but I'll post you my o/p. – Rushabh Shah Oct 9 '12 at 19:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .