How to schedule a reboot or shutdown daily at a certain time using command line. Applies to Windows 10/11
Below is an example of scheduling a shut down of a computer, daily at 6PM.
schtasks /create /sc daily /tn ShutdownAt6PM /tr “shutdown -s -f -t 2” /st 18:00 /NP
schtasks, command to schedule tasks. the AT command that used to be with earlier versions of Windows has been deprecated
/create, To create a new task
/sc, to schedule frequency. like once or daily.
/tn, name of the task. this is a description
/tr, this is the command to schedule like “Shutdown -s -f -t 2”. -s to shutdown, -f to force shutdown, -t 2 to delay by 2 seconds. The -s can be replaced by -r to reboot instead of shutdown.
/st, this is the time to execute the command.
/NP to run the schedule account on the Windows computers regardless whether the user is logged in or not.