我正在尝试为工作制作一个有用的批处理文件,为此,我正在尝试通过变量将注释/文本输入到 .txt 文件中。它非常适合只输入不带空格的文本(例如:“test”),但是一旦你输入了至少有 1 个空格的内容,cmd 就会关闭。(例如:“测试测试”)我不知道为什么会发生这种情况,所以我留在这里和你们在一起。任何/所有帮助将不胜感激!
@echo off
color 9F
title Notes
CLS
del %UserProfile%\Documents\Notes.txt
echo Issue/Request: >> %UserProfile%\Documents\Notes.txt
:StartCallNotes
CLS
echo ================== Notes =================
type %UserProfile%\Documents\Notes.txt
echo ==========================================
set /p NotesEnter=Enter Notes:
set NewNote="%NotesEnter%"
if %NotesEnter% == CLS goTo :CLS
echo %NotesEnter% >> "%UserProfile%\Documents\Notes.txt"
goTo :StartCallNotes
:CLS
del %UserProfile%\Documents\Notes.txt
echo Issue/Request: >> "%UserProfile%\Documents\Notes.txt"
goTo :StartCallNotes
exit