【问题标题】:Txt file password check batchtxt文件密码校验批处理
【发布时间】:2011-10-17 22:28:44
【问题描述】:

我希望我的脚本比较用户输入和 txt 文件中的文本(例如 test.txt) 我知道我可以使用type test.txt,但我不知道如何将它与用户输入进行比较...... 你能帮助我吗?谢谢你... 这就是我所拥有的:

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

【问题讨论】:

  • 文本文件包含什么?单线?多行?它们都必须匹配还是只有一行?
  • @Anders 一行..对不起..

标签: windows batch-file cmd


【解决方案1】:

您可以做的是将答案写入(临时)文件并比较文件。例如:

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

【讨论】:

    【解决方案2】:

    将要求输入密码猜测,如果找到,将输出到results.txt

    @echo off
    echo Password comparer
    set choice=
    set /p choice=Enter your password guess:
    
    TYPE test.txt | findstr /m %choice% > results.txt
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-11-02
      • 1970-01-01
      • 2022-11-28
      • 1970-01-01
      • 2017-09-01
      • 2016-07-17
      相关资源
      最近更新 更多