Windows 10 allows you to set when your display will sleep if you’ve been inactive for a certain amount of time. The time interval can be set to whatever suits you, and changing it is simple. All you need to do is open the Power Options in Control Panel and change it to whatever you like, or you can do it from the Settings app. While this setting is incredibly easy to change, you may not want to change it all the time if, let’s say you want to keep the display awake when an app is running. It’s tedious and you’ll have to change it back later. If you need to keep the display awake when a certain app is running, use a batch script instead.
Keep display awake when app is running
In order for this to work, make sure you do not have the screensaver enabled on Windows 10 because the script will not be able to prevent it from running.
Open Notepad and paste the following in it. You will have to modify it before you can use it.
@title KeepDisplayAwake @echo off setlocal enableextensions POWERCFG /CHANGE /MONITOR-TIMEOUT-AC 10 "C:\Windows\System32\notepad.exe" POWERCFG /CHANGE /MONITOR-TIMEOUT-AC 3 exit /b
The first line you need to modify is the ‘POWERCFG /CHANGE /MONITOR-TIMEOUT-AC 10’ line. You need to change the value given at the end. At present, this line changes the screen sleep time to 10 minutes after inactivity. Change it to a high value that suits you e.g, 60 if you’d like to keep the display from sleeping for an hour.
Next, you need to change this line “C:\Windows\System32\notepad.exe” and replace it with the complete path to the EXE of the app you want to use.
Last, you need to change this line “POWERCFG /CHANGE /MONITOR-TIMEOUT-AC 3”. This line resets the display timeout to whatever it was before. Change the value at the end i.e., 3 to what you normally use.
Save the file with the BAT file extension.
Make sure the app is not already running. Run the script and it will open the app. You can use it, and then leave it unattended. The script will keep a Command Prompt window open in the background to indicate that it is active. It will close automatically when you close the app, or when the timeout interval expires.
What this script does is, when you run it, it changes the display timeout for you and then runs the app that you intend to leave open on an unattended PC. When the app is quit, or the timeout interval expires, it resets the display timeout value to what it was before.
It is basically automating the process of changing the display timeout before and after using the app.