简体   繁体   中英

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:

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM