0
Is there a way to set up a task schedule, as in "Windows Task Scheduler", using batch files?
0
Is there a way to set up a task schedule, as in "Windows Task Scheduler", using batch files?
2
Look at schtasks.exe /?
For example, to create a task that starts notepad
five minutes after you log on, you can do this (only as an administrator, unfortunately):
schtasks /create /tn "\Automatic Notepad" /sc onlogon /delay 0005:00 /ru YOU /it /tr notepad.exe
Replace "YOU", of course. There is one problem: This will start the program when any user logs on, as long as you are also logged on. schtasks
does not appear to have an option to set the target user of a logon trigger.
However, if you only need to create tasks that run periodically, or that should run even when a user is not logged on, this may not affect you. You could also (although this is getting slightly past the capabilities of batch files) create the task definition in XML and create the task from that (schtasks /create /xml
), or create the task using the "normal" arguments, then export it (schtasks /query /tn ... /xml one
), insert the required line and reimport the task.
Can you clarify what you have tried and what exactly you are trying to do? – Burgi – 2016-10-21T22:08:02.207
I don't know how to better state it. I would like to use batch files to set up a few tasks on Task Scheduler. – Daniel – 2016-10-21T22:31:50.403