The code below works . . .
Code: Select all
set /p "time=>Please enter the Time in minutes and press <Enter>: "
set /a time=%time%*60
if %time% GEQ 1 (
echo The computer is getting ready to go to Sleep . . .
timeout %time% /nobreak > nul
%SystemRoot%\system32\rundll32.exe powrprof.dll, SetSuspendState 0,1,0
echo. & echo ^>Press ANY key to EXIT . . . & pause >nul & Exit
) else (
echo ERROR: You MUST enter the number of MINUTES^!
echo ^>Press ANY key to return to the Options . . . & pause >nul & cls & goto :Options
)
Code: Select all
set StartTime=%time%
set /p "time=>Please enter the Time in minutes and press <Enter>: "
set /a time=%time%*60
set /a time1=%time%*60
for /f "tokens=1*" %%a in ('PowerShell -NoP -C "(Get-Date).AddMinutes(%time1%).ToString('HH:mm')"') do (set "MyTime=%%a")
if %time% GEQ 1 (
echo The computer will go to sleep at %MyTime% . . .
timeout %time% /nobreak > nul
%SystemRoot%\system32\rundll32.exe powrprof.dll, SetSuspendState 0,1,0
echo ^>Press ANY key to EXIT . . . & pause >nul & Exit
) else (
echo ERROR: You MUST enter the number of MINUTES^!
echo ^>Press ANY key to return to the Options . . . & pause >nul & cls & goto :Options
)
. . . among other things but I can't seem to get it to work!for /f %%i in ('wmic OS Get LocalDateTime /Value ^& wmic Path Win32_LocalTime Get DayOfWeek /Value') do for /f %%j in ("%%i") do (set "%%j")
set "Hours=%LocalDateTime:~8,2%" & set "Minutes=%LocalDateTime:~10,2%"
Any help will be greatly appreciated.
Thanks in advance.