Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

up vote 3 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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.