Do you want to schedule a shutdown or a restart on the fly?

Are you seeking more flexibility when it comes to shutting down your PC?

Using the Command Prompt to shut down your PC at a specific time can be beneficial especially when you can’t wait for a task to finish.

This way you will not only save time, but you are going to become more productive.

In this tutorial, you will discover a new way to schedule or plan your shutdown using a CMD utility I made just for you ;)

Let’s dive in!

Shutdown/Restart Your Windows PC With CMD

Schedule Shutdown With CMD

There is an age-old command in Windows called shutdown with many attributes we will discover later.

For example to shutdown the PC after 1 hour (3600 sec’) we will use this command in Run:

shutdown -s -t 3600
Shutdown Restart Cmd Command Prompt Windows Run 1

This will trigger a notification in windows telling you the news.

Shutdown Restart Cmd Command Prompt Windows Run 2

Schedule Restart With CMD

Same thing if we want to restart, except this time we use -r instead of -s:

shutdown -r -t 3600
Shutdown Restart Cmd Command Prompt Windows Run 3

Cancel Shutdown Schedule

If you want to cancel the scheduled shutdown or restart just use this command:

shutdown -a
Shutdown Restart Cmd Command Prompt Windows Run 4

You will get this notification as a confirmation of canceling.

Shutdown Restart Cmd Command Prompt Windows Run 5

Free CMD Utility to Schedule a Shutdown/Restart

Here is a very simple script that you can use in order to schedule or plan your automatic shutdown or restart with ease.

Shutdown Restart Cmd Command Prompt Windows Run 6

Just open a new notepad file and paste the following, save as easytutorial.cmd.

@Echo off
GOTO MENU

:MENU
Echo !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Echo !! Easytutorial's Shutdown Planner !!
Echo !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Echo 1 - System Shutdown Planner
Echo 2 - System Restart Planner
Echo 3 - Cancel Planning
Echo !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
SET /p Action=Your choice (1,2 or 3) :

IF %Action% == 1 GOTO PlanShutdown
IF %Action% == 2 GOTO PlanRestart
IF %Action% == 3 GOTO CancelPlanning
IF %Action% GTR 3 GOTO Incorrect

:CancelPlanning
shutdown -a
Echo Planning Canceled
Goto Fin

:PlanRestart
Echo !! Info : 1 hour = 3600 seconds !!
SET /p Seconds= Seconds before Restart:
IF '%Seconds%' == '' GOTO PlanRestart
shutdown -r -t %Seconds%
GOTO Fin

:PlanShutdown
Echo !! Info : 1 hour = 3600 seconds !!
SET /p Seconds= Seconds before Shutdown:
IF '%Seconds%' == '' GOTO PlanShutdown
shutdown -s -f -t %Seconds%
GOTO Fin

:Incorrect
CLS
Echo !!! Attention : Value Entered Incorrect !!!
GOTO Menu

:Fin

Create Shutdown Shortcut

You can always create a shortcut to schedule your shutdown. Here is the location you should use:

%SystemRoot%\System32\shutdown.exe -f -s -t 3600
Shutdown Restart Cmd Command Prompt Windows Run 7

And your shortcut is ready!

Shutdown Restart Cmd Command Prompt Windows Run 8

Additional Details About the Shutdown Command

Here are some additional details about the other attributes of this shutdown command:

DescriptionParameter
Display help./?
Display the graphical user interface (GUI)./i
Log off. This cannot be used with /m or /d options./l
Shutdown the computer./s
Shutdown the computer. On the next boot, if Automatic Restart Sign-On is enabled, automatically sign in and lock the last interactive user./sg
After sign in, restart any registered applications.
Full shutdown and restart the computer./r
Full shutdown and restart the computer. After the system is rebooted, if Automatic Restart Sign-On is enabled, automatically sign in and lock the last interactive user./g
After sign in, restart any registered applications.
Abort a system shutdown./a
This can only be used during the time-out period.
Combine with /fw to clear any pending boots to the firmware.
Turn off the local computer with no time-out or warning./p
It can be used with /d and /f options.
Hibernate the local computer./h
It can be used with the /f option.
Performs a shutdown of the computer and prepares it for a fast startup./hybrid
Must be used with /s option.
Combine with a shutdown option to cause the next boot to go to the firmware user interface./fw
Document the reason for an unexpected shutdown of a computer./e
Go to the advanced boot options menu and restart the computer./o
Must be used with /r option.
Specify the target computer/m \\computer
Set the time-out period before shutdown to xxx seconds./t xxx
The valid range is 0-315360000 (10 years), with a default of 30. If the time-out period is greater than 0, the /f parameter is implied.
Comment on the reason for the restart or shutdown./c “comment”
A maximum of 512 characters allowed.
Force running applications to close without forewarning users./f
The /f parameter is implied when a value greater than 0 is specified for the /t parameter.
Provide the reason for the restart or shutdown./d [p|u]xx:yy
p indicates that the restart or shutdown is planned.
u indicates that the reason is user-defined.
xx is the major reason number (positive integer less than 256).
yy is the minor reason number (positive integer less than 65536).

There you have it!

If you have any thoughts for the mind to share don’t hesitate to leave a comment below ;)

Thanks for sharing!

Sofian – Easytutorial.com