Contact Form

Name

Email *

Message *

How to automatically shutdown your computer when you want



NOTE: The procedure I'm about to explain requires you to have administrative privileges on your PC.

Years ago, when I commuted for 150 km back and forth every day and I needed to leave at a certain time for me to get the train home, this trick saved me a lot of time and hassles.

Have you ever stared at a computer screen, cussing because Windows takes forever to shut down? How about those times when some applications won't close, causing the shutdown to abort or delay?

In my opinion, technology must be at your service and not vice versa, so I found an easier way to get this done.
 
The hack I'm about to show not only closes all the active applications, but forcibly kills any of them which should hang, freeze or prompt an input from the user (e.g. unsaved Word document).

More importantly, it's based on built-in Windows applications and doesn't require any third-party tools.

Prep step

An important preliminary step is to make sure you can access hidden and system files and view file extensions. For this purpose:
  • Open any folder in Windows Explorer and then go to "Organize/Folder and search options" from the menu.
  • Afterwards, open the View tab and make sure to:
  • select "Show hidden files and folders" and to:
  • deselect "Hide extensions for known file types".
  • That done, click Apply and OK.
Your View tab should look like the below picture.

The hack

Windows includes an application called shutdown.exe and located in C:\Windows\System32 that allows to shutdown the computer when run in a Command Prompt window.

This tool has a remarkable number of options. To get more information about how to use a command, you simply have to enter it in a Command Prompt, followed by" /? "(without quotes).

The figure below shows the output of the shutdown.exe/? command .


In order to shutdown a PC using this command, we'll need to use three switches:
  • s: shuts the computer down without restarting
  • t: specifies a delay in millisecond for this operation, In our case it'll be 0 because we don't have time to waste.
  • f: forces running applications to close without warning the user.
Therefore, if you enter in a Command Prompt the following command C:\Windows\System32\shutdown.exe /s /t0 /fit causes the computer to shutdown right away.

Good, you'd say, but then I have to go to a Command Prompt to get this done? Luckily there's a way to automate this.

You can create a batch file, i.e. a file containing a DOS command. When you double-click a batch file, you run the command contained in it just as if you'd run it from a Command Prompt.

To do this, go to Notepad and open a new file (Start/Search/Notepad), then paste the above command  C:\Windows\System32\shutdown.exe /s /t0 /f in the new file you created.

Name the file shutdown.bat and save it without any extensions (select "All Files"). 

Now, if you double click the file, your computer will be shut down right away.

Awesome, isn't it? You want all this to happen automatically, though.

We can use Task Scheduler to create a new task that will automatically open the file we just created (shutdown.bat), shutting down the PC at the desired time(s).

For this purpose, choose Create Basic Task, call the new task, called shutdown, and click Next. In the next screen, select when you want the task to start (daily, weekly, monthly, etc.) and click Next.

Afterwards, select the time when you want the task started and click Next.
Select the action you want the task to perform. The default option (Start a program) is perfect for our case. Click Next to proceed.


At this point, click Browse and select shutdown.bat from Documents (or from any folder you saved it to). Click Next.

In the next screen, click Finish to finish creating your new task. 
That's it! 

At the selected time(s) and day(s), your computer will shutdown automatically and you can make fun of your coworkers telling them you're a wizard, if you so prefer.

There's no magic involved here, anyway.

Comments

Related Posts Plugin for WordPress, Blogger...