如何仅替换文件中的文本(就像所有文本一样)

时间:2019-03-13 22:16:11

标签: batch-file text

我已经搜索了一段时间,Google的可怕算法给了我所有的东西,除了我一直在问的那个痛苦的问题。我正在尝试创建一种密码锁定脚本,并且正在尝试创建锁定功能。这是我到目前为止的内容:

@echo off

set tries=3

:type
set /p mytextfile=< zepassword.txt
if %mytextfile%==LOCKED goto locked

echo Please type in your key.
set /p okay=
if %okay%==yes goto good
if not %okay%==yes goto bad


:good 
cls
echo Correct Password.
pause >nul
exit

:bad 
cls
set /a tries=%tries%-1
echo This key is incorrect. %tries% tries remaining.
pause >nul
if %tries%==0 echo LOCKED >> zepassword.txt
goto type

:locked
cls
echo You are LOCKED OUT.
echo Press any key to unlock.
pause >nul
echo UNLOCKED >> zepassword.txt
pause >nul

1 个答案:

答案 0 :(得分:0)

SomethingDark为我回答了这个问题。

回显文本> [文件名]