Reputation: 173
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
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
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