PCs often Enter Sleep Mode When Left Unused for a While. If, For Any Reason, You Prefer Your System To Shut Down After A Period Of Inactivity, Do Not Miss This Article.
By default, operating systems are configured to reduce system resource consumption after a few minutes of inactivity or to put your computer to sleep if configured.
Suppose you prefer your computer to shut down automatically after a period of inactivity. In that case, you can use several methods to schedule the system to shut down automatically.
This article describes methods for Windows, macOS, and Linux.
Automatic shutdown of the computer in Windows
There are three ways to shut down a Windows computer automatically; each is explained below. You can use any of these three methods to automatically turn off Windows.
Schedule automatic shutdown of Windows with Task Scheduler
Task Scheduler is a Windows feature that lets you create scheduled tasks to power off the PC at a specific time. To do this, follow these steps:
- Press the Win key to open the Windows search bar.
- Type Task Scheduler and click the program icon in the search results to open it.
- In the Task Scheduler window, click on Action and select Create Basic Task.

- In the Basic Task window, type a name for the task you want to create (turn off the computer). For example, type Shutdown as the name. You can also provide a job description in the Description section. Click Next.
- You must now select the trigger time. This Time can be set as Timely, Weekly (Monthly), Monthly (Monthly), and Only Once (OneTimee).
- In this example, we selected Daily to power off the computer at a specific time. After selecting, click Next.
- Next, set the start date and Time for the repeated timedowns, then click Next.
- In the Action tab, select Start a program and click Next.
- In the Program / Script field, type shutdown.exe and click Next.
- Check the changes and click Finish to create a new task and add it to the Windows application.
The Task Scheduler executes the shutdown action daily at your specified Time and shuts down the computer.
Schedule Windows shutdown with CMD or Run
While the Task Scheduler is a powerful tool, it may not be intuitive for those who have not used it. You can also use the shutdown command on the Windows command line to turn off Windows automatically.
The shutdown command lets you automatically set a timer to shut down your Windows PC. To schedule a Windows shutdown with CMD:
- Press Win + X to open the WinX menu.
- Click on Windows Terminal (Admin) to open the following terminal.
- In the Windows Terminal window, type the following command and press Enter:
Shutdown /s -t N seconds
- In the above command, replace N seconds with the number of seconds. For example, if you want to set a timer for 5 minutes (300 seconds), the complete command would be:
Shutdown /s -t 300
- If you want a scheduled restart, type the following command: replace N seconds with the number of seconds to set a timer to restart, and press Enter.
Shutdown -t N seconds
- Type the following command and press Enter to cancel, turn off, or restart the timer. You will then see a logoff is canceled message indicating that the shutdown has been canceled.
Shutdown -a
The exciting thing about this method is that you can also type and execute commands using Run, or by running the same Windows executable with the Win + R key combination. Therefore, this method can be another way to power off the system automatically.
Automatically shut down Windows by creating desktop shortcuts
You can create a desktop shortcut with a timer to shut down your computer automatically. Creating shortcuts is helpful if you do not want to run Cmd every Time to set the Time. Follow the steps below to create a desktop timer blackout:
- Right-click on your Windows desktop and select New> Shortcut.
- Type the following command in the Type the location of item field, in which 300 seconds (5 minutes) indicates the number of timer seconds. You can adjust the seconds as needed.
Shutdown -s -t 300
- Click Next. —the Type of a name for your shortcut. Type ShutDownTimer, for example.
- Click the Finish button to add a desktop shortcut. To change the shortcut icon, right-click the ShutDownTimer desktop shortcut, select Properties, and click Change icon on the Shortcut tab.
- Choose the icon that best represents your blackout timer. In this example, we selected the power icon.
- Click OK to select the option. Then click Apply and OK to save the changes.
To start the shutdown timer, double-click the ShutDown Timer shortcut, then run the shutdown -a command in Command Prompt to cancel the scheduled shutdown.
Automatically turn off the PC on a Mac.
A section called Energy Saver in the Mac operating system settings is usually used to control screen shutdown when not in use, hard disk sleep mode, system wake-up to access the network, and system shutdown after a power outage. You can also use the Schedule option to schedule the device to turn on or off in this section.
To access Energy Saver on Mac:
- Click the Apple logo in the menu bar and select System Preferences.
- Click on Energy Saver.
- Then click on Schedule.
- Check the box next to the second drop-down menu. This menu lets you choose whether your Mac is turned off, restarted, or in sleep mode.
- Select Shut Down from the drop-down menu.
- Enter the Time and day. For Timeple, if you want the computer to shut down every night at 11:30 PM, select Every Day from the drop-down menu and enter 11:30 in the time box.
- Click OK to turn it off automatically at the specified Time when your systems are on.
Automatic shutdown of the computer in Linux
You must use a terminal to shut down Linux distributions automatically. In Ubuntu, the system shuts down as planned using the shutdown command, depending on the value you enter after P-.
Here are the steps to schedule a shutdown in Ubuntu using the shutdown command :
- Press Alt + Ctrl + T to open a terminal and type the command to shut down the system.
$ sudo shutdown -P +30
- In the example above, the 30+ parameter indicates the system shuts down after 30 minutes; change the timeline to 30.
You can also enter the exaTime in the system to Time off instead of setting the Time. The following command can be used to do this:
$ sudo shutdown -P 14:00
- This command instructs the system to shut down at 2 PM. To specify the exact shutdown time, enter the time in MM format after P. You can also replace P- with h-.
- If you want to cancel the scheduled shutdown, use the c -option after the shutdown command.
sudo shutdown -c
We hope you find this helpful tutorial. If you have any questions about automatically shutting down your computer on Windows, Mac, or Linux, please let us and other users know.
FAQ
How can I schedule an automatic shutdown on Windows?
On Windows you can use the built‑in shutdown command with a timer and Task Scheduler to run it at a specific time (for example, shutdown /s /t 3600 to shut down in one hour).
What is the method to automatically shut down a Mac?
macOS doesn’t include a simple GUI for shutdown timing; instead you can use a terminal command like sudo shutdown -h +60 to halt the system after 60 minutes.
How do you automate shutdown on Linux?
On Linux you can schedule an automatic shutdown using the terminal shutdown command with a specified time (e.g., sudo shutdown -h 20:00 to shut down at 8 PM) or create a cron job for repeated schedules.