我需要此文件为您提供3次输入密码的尝试,如果没有,则在第一次尝试失败后60秒以任何方式关闭或关闭 请帮忙
这是批处理文件
@echo off
color 02
set /a %tries%== 4
set /p %password%== Mike.1587
taskkill /f /IM explorer.exe
shutdown -s -t 60000
goto MAIN-LAUNCH
:MAIN-LAUNCH
cls
if %tries%==0 goto DEATH-OVERRIDE-SHUTDOWN
title Locked by %username%
echo Enter Password Before Time Runs Out...
echo You have %tries% tries left
set /p password=
if %password%==Mike.1587 goto IF-TRUE
if not /p password=Mike.1587 goto NOT-TRUE
:NOT-TRUE
%tries% -1
echo Incorrect Password Try Again...
echo You have %tries% left
echo Press any key to try again. . .
pathping localhost -q 2 -p 3500> nul
goto MAIN-LAUNCH
:IF-TRUE
echo Correct!
start explorer.exe
shutdown -a
pathping localhost -q 2 -p 1000> nul
exit
DEATH-OVERRIDE-SHUTDOWN
shutdown.exe /s /t 00
exit
答案 0 :(得分:0)
这应该做你想要的。很多批处理语法都不正确。我建议您在开始下一个项目之前先在线阅读基础教程。
@echo off
color 02
set /a tries=3
set /p P=Mike.1587
taskkill /f /IM explorer.exe
shutdown -s -t 60000
:: Start
:Attempt
cls
if "%tries%"=="0" goto Fail
title Locked by %username%
echo Enter Password Before Time Runs Out...
echo You have %tries% tries left
set /p "password=Password: "
if "%password%"=="%P%" goto Correct
:: Wrong Password
set /a tries-=1
echo Incorrect Password Try Again...
echo You have %tries% left
echo Press any key to try again. . .
pathping localhost -q 2 -p 3500> nul
goto Attempt
:Correct
shutdown -a
echo Correct!
start explorer.exe
pathping localhost -q 2 -p 1000> nul
exit
:Fail
shutdown.exe /s /t 00
exit