我如何做到这一点,以便它接受变量输入并在完成后创建一个文本文件

时间:2019-02-18 01:53:29

标签: batch-file arraylist user-input

我正在尝试制作一个程序,使您可以写书或待办事项清单

这是我刚刚想到的一个想法

["I", "love", "iceceam"]
["I", "want", "to", "eat", "chip"]

我希望它接受输入,而当您将篷“ N”接受时,将输入变量并将其放入文件中,但是当我篷“ N”时,它将停止与“ Y”的关联

1 个答案:

答案 0 :(得分:0)

也许是更好的版本?看来,这将是一个乏味的工具,而且毫无意义,因为那里有数百名优秀的编辑者,但是无论如何:

@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