-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