If you ever find yourself in a situation where you need to leave your computer on for several hours, but you want it to shut down once a certain process has finished, reddit user excelhelpneeded111 has a surprisingly simple solution. You don't need any third-party software, and it will only take a minute or two to set up.
Create a shutdown timer for Windows
To create a shutdown timer manually, open Command Prompt and type the command shutdown -s -t XXXX. The "XXXX" should be the time in seconds you want to elapse before the computer shuts down. For instance, if you want the computer to shut down in 2 hours, the command should look like shutdown -s -t 7200.
If you want to restart your computer on a delay, use shutdown -r -t XXXX instead.
To cancel the timer, open the Run window or Command Prompt again and enter shutdown -a.
Create a shutdown timer shortcut
If you need to use a shutdown timer regularly, you can take this trick one step further by turning it into a desktop shortcut.
- Right-click on the desktop, hover over New and select Shortcut in the side menu.
- In the path field type "shutdown -s -t XXXX" and click Next.
- Enter a name for the shortcut (for example, "Shutdown 1 Hour") and click Finish.
Any time you double-click the shutdown shortcut, the timer will start. To cancel the timer, you can create a second shortcut using shutdown -a or enter the shutdown -a command in Command Prompt.
To change the time on the shutdown timer, right-click the shortcut icon, select Properties and change the seconds value in the Target field. From within Properties, you can also assign a different image as the icon.
If you don't want to create a handful of sleep timer shortcuts or constantly edit the one you have to accommodate different time intervals -- or if you just want a graphical interface -- you're better off installing a dedicated program, like PC Sleep or Sleep Timer. These programs will give you additional options, such as the ability to log out, hibernate, set an exact shutdown time or shut down after a length of inactivity.
Editor's note: This article was updated March 3, 2017, to include additional information about Windows sleep timers.