Txt file password check batch

I want my script to compare user input and text from the txt file(test.txt for example) I know that I can use type test.txt but i dont know how to compare it with user input... Can you help me? thank you... This is what i have:

set choice=
set /p choice=Zvol si heslo slozky:

Upvotes: 0

Views: 797

Answers (2)

serk
serk

Reputation: 4399

Will ask to enter a password guess and will output to a results.txt if found.

@echo off
echo Password comparer
set choice=
set /p choice=Enter your password guess:

TYPE test.txt | findstr /m %choice% > results.txt

Upvotes: 0

wimh
wimh

Reputation: 15232

What you can do is write the answer to a (temporary) file and compare the files. For example:

...
echo %choice% > tempfile.txt
fc tempfile.txt test.txt > NUL
if errorlevel 1 echo answer is different as text.txt

Upvotes: 3

Related Questions