Simple script or batch to trip PM timers

tcsenter

Lifer
Sep 7, 2001
18,954
577
126
I want to create my own shortcut to run some maintenance tasks that take a long time, such as a disk check with full media scan or defrag. But wondering if the system will go to S3+S1 (or hybrid) sleep during a long process like this?

Any advice on how I could create a batch or script to reset system PM timer every couple minutes (or even up to 15 minutes) during this user-run task that will programmatically stop tripping the PM timer when the task is finished?

e.g. run task with PM trip script, then when task finishes and exits by returning a successful code (e.g. 0), stop triggering PM timers so the computer will enter sleep as normal? TIA!

Oh and something that will work on XP and up (Vista, 7, and 8).
 

Ken g6

Programming Moderator, Elite Member
Moderator
Dec 11, 1999
16,836
4,816
75
A quick Google turned up this page, with app and source code. Not exactly what you asked for, but you can modify the source code, I'm sure. For instance, you could have it exit when it no longer sees a file, and your batch could delete that file.