You can ask your computer to shut down automatically with a simple command, as we detailed in the instruction on coding a primary computer shutdown. This post focuses on the same function, but we will discuss how to carry it out with Windows 11 this time. The steps to program the shutdown using the CMD and a script, a file in BAT format, are contained in the following two parts.
Schedule Windows 11 shutdown with CMD
The Command Prompt, also known as CMD, is the ideal tool for scheduling Windows 11 PC shutdown. The identical command can be sent and carried out by the console in two different ways. The first of these can be carried out via the Run menu.
- To open the run dialog, press Windows + R.
- Run the shutdown -s -t (time in seconds) command.
- Substitute the final figure for the number of seconds until the computer shuts down.
- To start the command, press Enter.
You will get a notification right away warning you that the team will end the session at the appointed time. Just increase the number of minutes you want to delay the shutdown by 60 to get the seconds you need for the shutdown command. 60 minutes, for instance, are 3600 seconds (60 x 60).
As seen in the screenshot above, you may also first open the Command Prompt window and execute the same command there.
Check out the following available arguments to maximize the scheduled shutdown feature:
- shutdown -r -t (time in seconds) . Schedule the reboot.
- shutdown -h -t (time in seconds) . Schedule hibernation.
- shutdown -l -t (time in seconds) . Schedule logout.
- shutdown -hybrid -t (time in seconds) . Schedule shutdown and get ready for quick start.
To cancel any of these actions before the timer expires, use the shutdown -a command.
Shut down Windows 11 using a script (BAT file)
Another option for scheduling Windows 11 shutdown is to write a script in BAT format to automate the process further.
It’s as simple as following these steps:
- Launch Notepad on your computer.
- Enter the command you want to execute. Enter shutdown -s -t 3600, for example, to shut down the computer in one hour.
- Select File > Save As.
- Select All files from the Type dropdown in the Save dialogue.
- Give it a name and the extension.bat. For instance, shut down Windows in an hour. bat
It is recommended that you create many scripts so that you may run the command with various parameters. So, you could have a BAT file that shuts down the machine in an hour, restarts it every 30 minutes, or logs you out in 15 minutes. There are as many options as the possible combination of the shutdown command. To stop any of these actions, keep in mind that the shutdown -a command can potentially create a script.