I'm trying to make a script to shutdown my computer.
It asks for input wether the value will be in minutes or hours, in order to convert them to seconds for the shutdown command.
This is what my script looks like and it doesn't work.
@echo off
color 0a
:home
echo Hours (h) or minutes (m)?
set /p unit=
if "%unit%"=="h" (
echo For how long do you want to delay it?
set /p value=
set /a secs="value*=60*60"
) if "%unit%"=="m" (
echo For how long do you want to delay it?
set /p value=
set /a secs="value*=60"
) else (
goto:home
)
rem shutdown /s /f /t %secs%
echo %secs%
echo Closing in 3 seconds.
ping 127.0.0.1 -n 4 > nul
If anyone could lighten me up or come up with a better way to achieve it (which I'm sure exists), it'd be great.