I'm not very good at batch, and I'm trying to create this fake "hacker" so my friends and I can roleplay "nerdy I know lolz "
Anyways, here's the code if you need it.
@echo off
echo . . .
PING 1.1.1.1 -n 1 -w 2000 >NUL
goto Startup
:Startup
cls
echo Verifying User... input registered account credentials.
set /p Credentials=
if %Credentials%==VK11Cyanide06 goto Correct
if %Credentials%==QX19Trojan87 goto Cracked
if %Credentials% NOT==VK11Cyanide06 OR QX19Trojan87 goto Incorrect
I want VK11Cyanide06 and QX19Trojan87 to be acceptable variables and all other variables to goto "Incorrect". Can anyone tell me how to accomplish this?
How to make multiple variable acceptable while whitelisting any other variable?
Moderator: DosItHelp
-
- Expert
- Posts: 1166
- Joined: 06 Sep 2013 21:28
- Location: Virginia, United States
Re: How to make multiple variable acceptable while whitelisting any other variable?
Just remove the part of the last line. Batch scripts are read top-down, so once the first two if statements are passed and ignored, everything else will automatically go to Incorrect.
Code: Select all
if %Credentials% NOT==VK11Cyanide06 OR QX19Trojan87
-
- Posts: 128
- Joined: 23 May 2016 15:39
- Location: Spain
Re: How to make multiple variable acceptable while whitelisting any other variable?
Whenever you must evaluate two variables to boolean logic between them
Code: Select all
@echo off
setlocal
set /p var1="Val1, enter true or false: "
set /p var2="Val2, enter true or false: "
rem test AND
if "%var1%"=="true" if "%var2%"=="true" (
echo/&echo/Both are true & goto :done
)
rem test NOT logic
if not "%var1%"=="true" if not "%var2%"=="true" (
echo/&echo/None are true & goto :done
)
rem else OR
echo/&echo/One is true
:done
endlocal
exit/B