there is a command with a very massive amount of options: schtasks.

you can create a new task by runing a single-line command or batch.cmd that will show up in: taskschd.msc

so either open cmd-prompt or create a new text file called “restart every 2 days.cmd” and place this content:

REM fixed interval, restart every 2 days at 00:00 o'clock
schtasks /create /tn "restart every 2 days" /tr "shutdown -t 0 -r -f" /sc DAILY /mo 2 /st 00:00 /RL HIGHEST

examples:

REM fixed time, restart once at 12:15
schtasks /create /sc DAILY /tn "restart at 12:15" /tr "shutdown -t 0 -r -f" /st 12:15 /RL HIGHEST
REM fixed interval, restart every 10 minutes
schtasks /create /tn "restart every 10 minutes" /tr "shutdown -t 0 -r -f" /sc minute /mo 10 /RL HIGHEST

to full syntax help type in command prompt:

schtasks /Create /?

/sc -> valid values:

Schedule type Description
MINUTE, HOURLY, DAILY, WEEKLY, MONTHLY Specifies the time unit for the schedule.
ONCE The task runs once at a specified date and time.
ONSTART The task runs every time the system starts. You can specify a start date, or run the task the next time the system starts.
ONLOGON The task runs whenever a user (any user) logs on. You can specify a date, or run the task the next time the user logs on.
ONIDLE The task runs whenever the system is idle for a specified period of time. You can specify a date, or run the task the next time the system is idle.

liked this article?

  • only together we can create a truly free world
  • plz support dwaves to keep it up & running!
  • (yes the info on the internet is (mostly) free but beer is still not free (still have to work on that))
  • really really hate advertisement
  • contribute: whenever a solution was found, blog about it for others to find!
  • talk about, recommend & link to this blog and articles
  • thanks to all who contribute!
admin