langlro1
asked on
How to sleep with the option of an interrupt
Hi
I have a dos batch file that processes some commands every 20 mins. I would like to add the option of a 'hot key' that would abort the sleep command and process the commands again.
for example
echo Press r to run now
Thanks
Rob
I have a dos batch file that processes some commands every 20 mins. I would like to add the option of a 'hot key' that would abort the sleep command and process the commands again.
for example
echo Press r to run now
Thanks
Rob
set sleep 20
:again
do some stuff here
set msg= Sleeping for %sleep% Mins
echo %msg%
call :slepLoop
goto again
:slepLoop
REM echo that supports surpress line feed downloaded from
REM http://www.paulsadowski.com/WSH/cmdprogs.htm
%utilDir%\sleep 60
%utilDir%\echo .\c
set /a ctr2=ctr2+1
if %ctr2% GEQ %sleep% goto loopEnd
goto slepLoop
:loopEnd
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
By piping choice into nul, then my screen output was not messed up by choice.. :-)
see my snippet below
Open in new window