-4
该项目是一个带有登录屏幕的小型命令终端。但是,在我通过登录后,它无法再打开。有没有人有任何建议/修复? (另外,我认识到,部分代码不是由我做100%)为什么登录后不会运行此批处理脚本?
@echo off
:LOGIN
set/p uname= < HoodedBlack
set/p pass=< Password
title Login
cls
echo -------------------------------------------------
echo HoodedBlack's Mainframe V0.1
echo Login
echo -------------------------------------------------
echo.
echo.
set/p "unamel= Username :
set/p "passwordl= Password :
echo.
IF "%passwordl%"=="Password" goto LOADING
IF NOT "%passwordl%"=="Password"
goto ERROR
:ERROR
echo -------------------------------------------------
echo Error
echo -------------------------------------------------
echo Invalid Username or password
echo An Admin has been notified of this attempt.
pause
:LOADING
title Loading...
set load=%load%!!!!!!!
cls
echo -------------------------------------------------
echo Login
echo -------------------------------------------------
echo.
echo.
echo Username : %unamel%
echo Password : %passwordl%
echo.
echo.
echo Logging in...
echo ===================================
echo %load%
echo ===================================
echo. Please Wait...
echo.
ping localhost -n 2 >nul
set/a loadnum=%loadnum% +1
if %loadnum%==5 goto DONE
goto LOADING
:DONE
title Done
cls
echo -------------------------------------------------
echo Done
echo -------------------------------------------------
echo.
echo #
echo #
echo # # Login Successfully
echo # #
echo #
echo.
echo.
echo -------------------------------------------------
pause
goto WELCOME
:WELCOME
title Welcome
cls
echo ----------------------------------------------------
echo Welcome, HoodedBlack! Your rank is: Mainframe Owner
echo Mainframe v0.1 HoodedBlack
echo ----------------------------------------------------
echo.
echo Hello!
echo Say "cmds" for a list of commands
echo or say "exit" to exit the mainframe
echo.
echo.
echo.
echo.
set INPUT=
set /P INPUT=Type input: %=%
If %INPUT%=="cmds" goto cmds
If NOT %INPUT%=="cmds"
then
If %INPUT%=="exit" goto exit
If NOT %INPUT%=="exit"
then
If %INPUT%=="DDoS" goto DDoS
If %INPUT%=="DDoS"
then
If %INPUT%=="DoS" goto DoS
If %INPUT%=="DoS"
then
If %INPUT%=="Password" goto pword
If NOT %INPUT%=="Password"
then pause
:cmds
title cmds
cls
echo -------------------------------------------------
echo Commands list
echo -------------------------------------------------
echo.
echo DDoS: Redirects you to a ddos service.
echo DoS: Sends a ping dos attack
echo (More commands coming soon!)
echo -------------------------------------------------
pause
goto WELCOME
:exit
title exit
exit
:DDoS
start www.alphastress.com
:DoS
title cmds
cls
echo -------------------------------------------------
echo Ping attack (Denial Of Service)
echo -------------------------------------------------
echo Select an IP to send the attack to
echo
echo -------------------------------------------------
:pword
title Password Generator
cls
echo I will make you a new password.
echo Please write the password down somewhere in case you forget it.
echo ---------------------------------------------------------------
echo 1) 1 Random Password
echo 2) 5 Random Passwords
echo 3) 10 Random Passwords
echo Input your choice
set input=
set /p input= Choice:
if %input%==1 goto A if NOT goto Start2
if %input%==2 goto B if NOT goto Start2
if %input%==3 goto C if NOT goto Start2
:A
cls
echo Your password is %random%
echo Now choose what you want to do.
echo 1) Go back to the beginning
echo 2) Exit
set input=
set /p input= Choice:
if %input%==1 goto Start2 if NOT goto Start 2
if %input%==2 goto Exit if NOT goto Start 2
:Exit
exit
:B
cls
echo Your 5 passwords are %random%, %random%, %random%, %random%, %random%.
echo Now choose what you want to do.
echo 1) Go back to the beginning
echo 2) Exit
set input=
set /p input= Choice:
if %input%==1 goto Start2 if NOT goto Start 2
if %input%==2 goto Exit if NOT goto Start 2
:C
cls
echo Your 10 Passwords are %random%, %random%, %random%, %random%, %random%, %random%, %random%, %random%, %random%, %random%
echo Now choose what you want to do.
echo 1) Go back to the beginning
echo 2) Exit
set input=
set /p input= Choice:
if %input%==1 goto Start2 if NOT goto Start 2
if %input%==2 goto Exit if NOT goto Start 2
你在'uname1'和'password1''set/p'行缺少关闭引号,但是这是除了_actually_破坏你的代码外。如果您要使用多行if语句来验证“%password1%”等于“Password”,您需要使用圆括号。 – SomethingDark
@HoodedBlack虽然在Windows批处理中学习和编写脚本可能很有用,但您也可以尝试使用PowerShell。使用起来更容易,具有很好的文档并且非常强大。我建议你试试PowerShell,我相信你会爱上它的。顺便说一句,PowerShell随Windows一起提供,你不需要安装任何东西来开始使用它。请参阅https://powershell.org/和https://msdn.microsoft.com/en-us/powershell/ – bahrep