该项目是一个带登录屏幕的小型命令终端。但是,在我通过登录后,它再也无法打开。有没有人有任何建议/修复? (另外,我意识到代码的某些部分并非由我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
答案 0 :(得分:0)
谢谢 bahrep ...
HoodedBlack - &gt;一些重组和一些新命令要检查:
@echo off
setlocal
:MAIN_LOOP
call :LOGIN
if "%AUTHENTICATED%" == "TRUE" (
call :LOADING
call :WELCOME
)
goto MAIN_LOOP
endlocal
goto END
REM ****************************************************************************
:LOGIN
set UNAME=HoodedBlack
set PASS=Password
set AUTHENTICATED=TRUE
set UNAMEL=
set PASSWORDL=
title Login
cls
color 0a
echo -------------------------------------------------
echo HoodedBlack's Mainframe V0.1
echo Login
echo -------------------------------------------------
echo.
echo.
set/p "UNAMEL= Username :
set/p "PASSWORDL= Password :
echo.
REM *** /i makes comparison non-case sensitive.
if /i "%UNAMEL%" NEQ "%UNAME%" set AUTHENTICATED=FALSE
if "%PASSWORDL%" NEQ "%PASS%" set AUTHENTICATED=FALSE
if "%AUTHENTICATED%" == "TRUE" (
call :LOGIN_OK
goto END
)
color 4e
title Access Denied
echo -------------------------------------------------
echo Error
echo -------------------------------------------------
echo Invalid Username or password
echo An Admin has been notified of this attempt.
echo.
echo Press any key.
pause>nul
goto END
REM ****************************************************************************
:LOADING
title Loading...
set /a LOADNUM=0
set LOAD=
:LOAD_LOOP
set LOAD=%LOAD%!!!!!!!
cls
echo -------------------------------------------------
echo Login
echo -------------------------------------------------
echo.
echo.
echo Username : %unamel%
rem echo Password : %passwordl%
echo.
echo.
echo Logging in...
echo ===================================
echo %LOAD%
echo ===================================
echo. Please Wait...
echo.
ping localhost -n 2 >nul
set /a LOADNUM+=1
if %LOADNUM% LSS 5 goto LOAD_LOOP
goto END
REM ****************************************************************************
:LOGIN_OK
title Done
cls
echo -------------------------------------------------
echo Done
echo -------------------------------------------------
echo.
echo #
echo #
echo # # Login Successfully
echo # #
echo #
echo.
echo.
echo -------------------------------------------------
pause
goto END
REM ****************************************************************************
: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.
:INPUT_LOOP
set INPUT=
set /P INPUT=Type input:
if /i "%INPUT%" == "CMDS" call :CMDS & goto INPUT_LOOP
if /i "%INPUT%" == "DDOS" call :DDoS & goto INPUT_LOOP
if /i "%INPUT%" == "DOS" call :DoS & goto INPUT_LOOP
if /i "%INPUT%" == "PASSWORD" call :pword & goto INPUT_LOOP
if /i "%INPUT%" == "EXIT" goto END
echo Unrecognised command.
goto INPUT_LOOP
REM ****************************************************************************
:CMDS
title cmds
echo.
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 -------------------------------------------------
echo.
goto END
REM ****************************************************************************
:DDoS
start www.alphastress.com
goto END
REM ****************************************************************************
:DoS
title cmds
cls
echo -------------------------------------------------
echo Ping attack (Denial Of Service)
echo -------------------------------------------------
echo Select an IP to send the attack to
echo.
echo -------------------------------------------------
pause
goto END
REM ****************************************************************************
: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" (
echo Your password is %RANDOM%.
goto PASSWORD_DONE
)
if "%INPUT%" == "2" (
echo Your 5 passwords are %RANDOM%, %RANDOM%, %RANDOM%, %RANDOM%, %RANDOM%.
goto PASSWORD_DONE
)
if "%INPUT%" == "3" (
echo Your 10 Passwords are %RANDOM%, %RANDOM%, %RANDOM%, %RANDOM%, %RANDOM%, %RANDOM%, %RANDOM%, %RANDOM%, %RANDOM%, %RANDOM%.
goto PASSWORD_DONE
)
echo Invalid option - press any key.
pause >nul
goto PWORD
:PASSWORD_DONE
echo.
goto END
REM ****************************************************************************
:END
REM ****************************************************************************
我同意上面的PowerShell参考资料。的Windows&#39; shell脚本有点挑剔,主要是因为更先进的东西已经被贴在&#34;而不是&#34;设计在&#34;中。其中一个例子就是子程序 - 是的,你可以这样做(参见上面的调用:SUBROUTINE_NAME ),但他们不支持 return 语句。相反,您必须强制脚本到达文件的末尾,此时命令解释程序意识到它的&#34;堆栈&#34;中有一个返回行号。这就是为什么你会在上面看到转到END (标签:END 可以是任何名字)。
祝你好运!