我正在尝试制作一个程序,让您写一些书籍或待办事项清单
这是我一个想法
SET /P line1=""
SET /P adlne=[add another line? Y or N?]
IF "adlne"=="Y"
GOTO :a
IF "adlne"=="N"
GOTO :b
:a
SET /P line2=""
SET /P adlne=[add another line? Y or N?]
IF "adlne"=="Y"
GOTO :a1
IF "adlne"=="N"
GOTO :b
:b
set list = "line1, line2, line3"
(for %%a in (%list%) do (
echo %%a
echo/
)) > theFile.txt
pause
我希望它可以接受输入,当您awnser" n"为输入变量并将它们放在文件中,但是当我awnser" n"时,它会停止使用" y"
也许是更好的版本?这将是一个乏味的工具,并且根本没有任何意义,因为那里有100位出色的编辑,但无论如何:
@echo off
choice /C CA /M "Clean file or append to previous notes? "
if "%errorlevel%"=="1" type nul>theFile.txt
:write
set /P line=line :
echo %line% >>theFile.txt
echo/>>theFile.txt
choice /C YN /M "add another line? "
if "%errorlevel%"=="1" goto :write
pause