我已经多次尝试让这批工作,但它不会,它让我发疯。在我屈服于提出问题之前,我还梳理了这个网站并尝试了许多不同的东西。
我有一批将根据您选择的选项进行关机、重新启动或注销。当我运行它并希望通过检查答案以查看它是否为零来从几小时到几分钟到几秒时,问题就出现了。它给出了错误“有一个意外的(”并立即关闭。如果我把它拆开并单独运行它,它就可以工作。
这是包含 If 语句的主要函数。如果你想看整批我可以给你。我已经注释掉了 shutdown 的实际使用,只是为了帮助弄清楚这一点。解决此问题后,将删除 REM'd out 关闭行之前的 2 行。
:SR_MAIN
cls
echo+
echo+
set /p SR_hrs=....Please enter the number of hours before %SR_NAME%:
IF "%SR_hrs%" == 0 (
echo+
echo You don't want hours, huh?
timeout /t 2 > nul
cls
echo+
echo+
set /p ptm=....Please enter the number of minutes before %SR_NAME%:
IF %ptm% == 0 (
echo+
echo You don't want minutes, huh?
timeout /t 2 > nul
cls
echo+
echo+
set /p pts=....Please enter the number of seconds before %SR_NAME%:
IF %pts% == 0 (
echo+
echo Exiting to Shutdown menu...
timeout /t 2 > nul
goto SHUTREMENU
) ELSE (
cls
echo+
echo+
echo This will %SR_NAME% the computer in the seconds you provided.
set /a tm=pts
echo+
echo Waiting %tm% seconds before continuing...
echo+
timeout /t %tm%
echo Now would come the %SR_NAME%!
pause
REM shutdown /f /%SR_N% /t 0
exit
)
) ELSE (
cls
echo+
echo+
echo This will %SR_NAME% the computer in the minutes you provided.
set /a tm=ptm*60
echo+
echo Waiting %ptm% minutes (%tm% seconds) before continuing...
echo+
timeout /t %tm%
echo Now would come the %SR_NAME%!
pause
REM shutdown /f /%SR_N% /t 0
exit
)
) ELSE (
cls
echo+
echo+
echo This will %SR_NAME% the computer in the hours you provided.
set /a tm=SR_hrs*60*60
echo+
echo Waiting %SR_hrs% hours (%tm% seconds) before continuing...
echo+
timeout /t %tm%
echo Now would come the %SR_NAME%!
pause
REM shutdown /f /%SR_N% /t 0
exit
)
:MAIN_MENU
ECHO Exiting to Main Menu...
PAUSE
谢谢你提供的所有帮助。这对我来说是一个真正的难题。
Ĵ