Jump to content

[UPDATED] System Restart/Shutdown Timer with time interval and specific time action


wdm

Recommended Posts

@ECHO OFF

COLOR 0E

REM ******************************************************

REM BatchGotAdmin

REM --> Check for permissions

>NUL 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"

REM --> If error flag set, we do not have admin.

IF '%errorlevel%' NEQ '0' (

ECHO.

ECHO Requesting Administrative Privileges...

GOTO UACPrompt

) ELSE ( GOTO gotAdmin )

:UACPrompt

ECHO SET UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"

ECHO UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"

"%temp%\getadmin.vbs"

EXIT /B

:gotAdmin

IF EXIST "%temp%\getadmin.vbs" ( DEL "%temp%\getadmin.vbs" )

PUSHD "%CD%"

CD /D "%~dp0"

REM ******************************************************

@ECHO OFF

COLOR 0F

ECHO *****************************************************

ECHO * *

ECHO * System RS Timer *

ECHO * by drazen11 a.k.a wdm *

ECHO * *

ECHO *****************************************************

ECHO.

ECHO ----------------------------

ECHO Select A Desired Timer Mode:

ECHO ----------------------------

ECHO.

ECHO To Restart/Shutdown After A Specific Interval of Time Enter [i/j]

ECHO.

ECHO To Restart/Shutdown At A Specific Time Enter [k/l]

ECHO.

CHOICE /C ijkl /N

CLS

IF ERRORLEVEL 4 GOTO SPECIFICTIME4

IF ERRORLEVEL 3 GOTO SPECIFICTIME3

IF ERRORLEVEL 2 GOTO TIMEINTERVAL2

IF ERRORLEVEL 1 GOTO TIMEINTERVAL1

:TIMEINTERVAL1

COLOR 2F

ECHO.

SET /P TIMEOUT= Enter The Time Interval In Minutes And Press ENTER:

SET /A TIMEOUT=TIMEOUT*60

SHUTDOWN.EXE -R -T %TIMEOUT%

SET /A TIMEOUT=TIMEOUT/60

CLS

ECHO *****************************************************

ECHO * *

ECHO * System RS Timer *

ECHO * by drazen11 a.k.a wdm *

ECHO * *

ECHO *****************************************************

ECHO.

ECHO The System Will Restart In %TIMEOUT% Minutes.

ECHO.

TIMEOUT /T 5 > NUL

ECHO Please Wait...

CLS

ECHO.

CHOICE /C yn /T 10 /D n /N /M "Press [y] To ABORT Or [n] To Continue Countdown."

IF ERRORLEVEL 2 GOTO END

IF ERRORLEVEL 1 GOTO ABORTI

:TIMEINTERVAL2

COLOR 2F

ECHO.

SET /P TIMEOUT= Enter The Time Interval In Minutes And Press ENTER:

SET /A TIMEOUT=TIMEOUT*60

SHUTDOWN.EXE -S -T %TIMEOUT%

SET /A TIMEOUT=TIMEOUT/60

CLS

ECHO *****************************************************

ECHO * *

ECHO * System RS Timer *

ECHO * by drazen11 a.k.a wdm *

ECHO * *

ECHO *****************************************************

ECHO.

ECHO The System Will Shutdown In %TIMEOUT% Minutes.

ECHO.

TIMEOUT /T 5 > NUL

ECHO Please Wait...

CLS

ECHO.

CHOICE /C yn /T 10 /D n /N /M "Press [y] To ABORT Or [n] To Continue Countdown."

IF ERRORLEVEL 2 GOTO END

IF ERRORLEVEL 1 GOTO ABORTI

:SPECIFICTIME3

COLOR 4F

REM The Following Command Delete Previously Completed Task.

REM Attention! The Task Named "At1" Will Be Deleted.

SCHTASKS /DELETE /TN At1 /F

CLS

ECHO.

SET /P TIMEOUT= Enter The Desired TIME [HH:MM] And Press ENTER:

AT %TIMEOUT% CMD /C SHUTDOWN -R -T 10

CLS

ECHO *****************************************************

ECHO * *

ECHO * System RS Timer *

ECHO * by drazen11 a.k.a wdm *

ECHO * *

ECHO *****************************************************

ECHO.

ECHO The System Will Be Restart In The EXACT %TIMEOUT%

ECHO.

TIMEOUT /T 5 > NUL

ECHO Please Wait...

CLS

ECHO.

CHOICE /C yn /T 10 /D n /N /M "Press [y] To ABORT Or [n] To Continue Countdown."

IF ERRORLEVEL 2 GOTO END

IF ERRORLEVEL 1 GOTO ABORTT

:SPECIFICTIME4

COLOR 4F

REM The Following Command Delete Previously Completed Task.

REM Attention! The Task Named "At1" Will Be Deleted.

SCHTASKS /DELETE /TN At1 /F

CLS

ECHO.

SET /P TIMEOUT= Enter The Desired TIME [HH:MM] And Press ENTER:

AT %TIMEOUT% CMD /C SHUTDOWN -S -T 10

CLS

ECHO *****************************************************

ECHO * *

ECHO * System RS Timer *

ECHO * by drazen11 a.k.a wdm *

ECHO * *

ECHO *****************************************************

ECHO.

ECHO The System Will Be Shutdown In The EXACT %TIMEOUT%

ECHO.

TIMEOUT /T 5 > NUL

ECHO Please Wait...

CLS

ECHO.

CHOICE /C yn /T 10 /D n /N /M "Press [y] To ABORT Or [n] To Continue Countdown."

IF ERRORLEVEL 2 GOTO END

IF ERRORLEVEL 1 GOTO ABORTT

:ABORTI

SHUTDOWN -A

CLS

ECHO.

ECHO Aborted!

GOTO END

:ABORTT

SCHTASKS /DELETE /TN At1 /F

CLS

ECHO.

ECHO Aborted!

GOTO END

:END

TIMEOUT /T 5 > NUL

CLS

ECHO.

ECHO Closing...

TIMEOUT /T 5 > NUL

EXIT

Edited...

Rename attachment extension from .txt to .bat

Enjoy!

B)

MYTIMER.txt

Link to comment
Share on other sites


  • Replies 2
  • Views 1.7k
  • Created
  • Last Reply

1.Open the .txt file in notepad

2.Click Save as from file menu

3.c9s2n86d6qlqgrxq7io8.jpg

then open the file

EXPLORING PROGRAMMING SO MUCH OF FUN AND PEACE :yes: :D

Link to comment
Share on other sites


  • 4 weeks later...

1.Open the .txt file in notepad

2.Click Save as from file menu

3.c9s2n86d6qlqgrxq7io8.jpg

then open the file

EXPLORING PROGRAMMING SO MUCH OF FUN AND PEACE :yes: :D

T.HANKS :lol:

is_tom_hanks-jewish.jpg

Link to comment
Share on other sites


Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...