Reputation: 3086
I have a batch file to shutdown the PC
@echo off
Shutdown /s /f /t 600 /c "Your system will shutdown in 10 min"
To abort this operation I've another one
shutdown /a
Now what I'm looking for is there any way that when I launch the first batch file it should prompt me to abort the operation or not. If I abort the operation it should be prompt me after 10 min the same option and I want it in loop until I don't accept the operation to done.
I've Googled for it but got nothing so far. Only got some 3rd party tools to do shutdown without abort option.
Is it possible? If yes any help would be appreciated.
Upvotes: 3
Views: 36657
Reputation: 4516
Did this in a single batch file. If you want it to run every 10 minutes don't want the window to stay there for those 10 minutes timegap, then remove the 'timeout and goto' and run it using the Windows Task Scheduler
@ECHO OFF
:myLabel
SHUTDOWN /S /F /T 600
SET /P continue="Your computer is about to shutdown in 10 min do you want to abort (y/n): "
IF %continue% EQU y (
SHUTDOWN /A
TIMEOUT /T 600 /NOBREAK
GOTO myLabel
)
Upvotes: 5