Home / Exciting tips / Windows / How to create a sleep timer for any app on Windows 10

How to create a sleep timer for any app on Windows 10

There are many apps that can keep a system from going to sleep if they’re busy, and some can even shut the system down once they’ve completed an action. This last type is rare. In fact, you’ll find that it’s mostly torrent clients that have this sort of feature. The ability to automatically be able to shut down a system when an app quits is called a sleep timer. Spotify has one but it is a very rare exception. You’ll find that there are lots of ways to schedule a shut down on Windows 10 but they will all force close apps. If you’d like for an app to be quit, and then for the system to shut down, you’re going to have to create the sleep timer for it yourself. It’s pretty simple and you only need a batch script to do the job and a scheduled task.

Create batch script

Open Notepad and paste the following in it. Relace app.exe with the name of the app that you want to quit. Save the file with the BAT file extension. This script will quit the app that’s running, and it will shut down your system one minute after it has closed the app.

taskkill /IM app.exe shutdown -s -t 60

Example

taskkill /IM vlc.exe shutdown -s -t 60

Create scheduled task

This scheduled task will run the script you created in the previous section. Open Task Scheduler and create a new task. Give it a name that tells you which app it will close and then go to the Triggers tab. Add a new trigger.

The trigger should be set to ‘On a schedule’ and you should select the ‘One Time’ option unless you know with absolute certainty that you will need to close an app and shut down your system at a definite time every day. In that case, feel free to use the other scheduling options.

Once you add the trigger, go to the Actions tab and add a new action. Leave it set to ‘Run a program’, and select the script you created. Once you create the task, it will be enabled by default.

If you set the task to run only once, you will have to modify the trigger the next time you need to use a sleep timer. This is the safe way to do it as it won’t sneak up on you should you forget about the task.

You can also modify the script and have it close the app but leave your system running. All you need to do is remove the second line from the script.

Be warned that the script will not automatically save anything that’s open in the app.

About excitingtips

Check Also

The Wizard Could Not Start Microphone (Windows 10): Here’s How to Fix It

All laptops come with a built-in microphone and they have support for external mics while …

Leave a Reply

Your email address will not be published. Required fields are marked *