Posts tagged windows scheduler
When working with scheduled tasks on a windows machine, I often wished I could work on the command line with the scheduler. As we all know, a command line interface gives us the ability to script, preventing manual repeating work.
Unfortunately, until a few days ago I did not find a solution for this, but after another extensive search I found schtasks.exe. It turned out this tool was already available from Windows server 2003.
The command line tool gives the ability to do everything you can do in the Windows scheduler. As common, using the /? parameter gives the basic options which are:
The first purpose I used it for was creating range of backup jobs which had to be executed during the night, and deleted afterwards (one-time only):SCHTASKS /Create /RU AMIS\<username> /RP "my passw" /SC ONCE /TN "Name of scheduled task" /TR "c:\path\to\my\command.cmd" /ST HH:MM /SD MM/DD/YYYY /Z
Let’s have a look at the parameters used in this case:
- /Create The obvious: create a new scheduled task
- /RU The user as which the task should be executed
- /RP The password for the user executing the task
- /SC The schedule this task More >