我想我的腳本比較用戶輸入和文本從txt文件(例如test.txt) 我知道我可以使用type test.txt
,但我不知道如何將其與用戶輸入進行比較.. 你能幫我嗎?謝謝... 這是我有:Txt文件密碼檢查批次
set choice=
set /p choice=Zvol si heslo slozky:
我想我的腳本比較用戶輸入和文本從txt文件(例如test.txt) 我知道我可以使用type test.txt
,但我不知道如何將其與用戶輸入進行比較.. 你能幫我嗎?謝謝... 這是我有:Txt文件密碼檢查批次
set choice=
set /p choice=Zvol si heslo slozky:
你可以做的是寫答案的(臨時)文件,並比較文件。例如:
...
echo %choice% > tempfile.txt
fc tempfile.txt test.txt > NUL
if errorlevel 1 echo answer is different as text.txt
Thx男人......這就夠了非常感謝 –
會詢問是否發現輸入密碼猜測,將輸出到results.txt
。
@echo off
echo Password comparer
set choice=
set /p choice=Enter your password guess:
TYPE test.txt | findstr /m %choice% > results.txt
該文本文件包含什麼內容?一條線?多行?他們都必須匹配還是隻有一行? – Anders
@Anders單行..對不起.. –