Automatic Timed Shutdown with Command Prompt (CMD)

Hi Guys,

It happens a lot, that we need someone else’ assistance to shut down our computers, in case we have to leave urgently, but we won’t need that assistance anymore.

Why can I need Automatic Shutdown for?

There can be infinitely many scenarios where you might need to shut down your computer after a certain period of time, for example –

  • While waiting for a download to complete.
  • While waiting for a long antivirus scan.
  • While waiting for any thing which is gonna take a predictable amount of time.
  • Or maybe playing a cruel prank on a friend ??

For any such event, we can just set the timer 10-15 minutes more than their estimated time of completion and just go on with your other work.

What is Command Prompt aka CMD?

A command prompt is an entry point for typing commands to the computer. By typing commands at the command prompt, you can perform tasks on your computer without using the Windows graphical interface.

You can do almost all the things with CMD, which you can do with the Operating System, sometimes even more.

How to trigger an automatic shutdown?

Follow these steps –

  • Press Windows button + R, to get to Run.
  • The commands can be directly entered here.
  • The command to shut down is shutdown -s
  • This command will shutdown your computer in 1 minute. You will get this message.
     

How to set a time period and other functionalities?

Command to automatic shutdown –

shutdown -s

Command to cancel shutdown –

shutdown -a

Command to schedule shutdown after 5 min (300 seconds) –

shutdown -s -t 300
One can set any amount of time in seconds format, like for 10 minutes, command will be shutdown -s -t 600

Command to add a custom message “LOL :)” with shutdown –

shutdown -s -c “LOL :)”
One can set any custom message, like “Revenged”, command will be shutdown -s -c “Revenged”

Command to restart computer –

shutdown -r

Note –

One can use several of these commands in a single command. For example, commands like the one below will work.

shutdown -r -t 3600 -c “I took my revenge.”

That’s all folks.

Image Source – thedailybuggle.com (Featured image) and Swapnil’s Compaq Laptop (for other screenshots).
Data source – codechewing.com.
Author – Swapnil Jha