Scheduled batch that puts the computer to sleep

Discuss new features and functions
Posts: 1
Joined: 29 Jan 2022

macson

HI!

I'm setting up a Windows Scheduled Task to wake up my computer in the middle of the night and perform a batch backup, I would like the computer to go back to sleep so when saving the batch i checked the "Shut down (Sleep)"-option.

When testing this a couple of times my computer keeps jumping in to sleep mode and I figured a nice feature would be to show a propt "Computer will go to sleep in 20 s" or something so that I can abort this if I'm actually using the computer in the middle of the night.
User avatar
Posts: 2451
Joined: 22 Aug 2012

Plerry

Try entering your own suitable user defined shutdown command in the "Run a command" box in the Synchronization Settings (F8).
User avatar
Posts: 4056
Joined: 11 Jun 2019

xCSxXenon

You would need to use a script that detects user interaction and doesn't run the sleep command if there is any. Start with finding out how to write or find a script that can detect user presence before acting.
User avatar
Posts: 4056
Joined: 11 Jun 2019

xCSxXenon

cmd doesn't really have a good way to go to sleep and allow it to be interrupted.
Nvm, this is easy
Run a CHOICE cmd that defaults to yes after 20 seconds, and set it so choosing no aborts the script instead of continuing and running a command to go to sleep.