我正在尝试制作一个批处理文件来检查 xy.txt 中是否存在用户输入,这很容易
    @echo off 
    set /p input=" "
    findstr /c:"%word%" xy.txt > NUL
    if ERRORLEVEL 1 goto notexist
    if ERRORLEVEL 2 goto exist
    :exist
    echo user input does exist 
    pause > nul
    exit
    :notexist
    echo user input does not exist 
    pause > nul\
但现在如果用户输入是“hello world”,我想单独检查每个单词。
我试过这个,但它不好......如果这个词不存在,它会保存
    @setlocal enableextensions enabledelayedexpansion
    @echo off
    :start
    set /p word=" "
    for /F "tokens=* delims= " %%A in ("%word%") do set A=%%A & set B=%%B 
    if %A%=="" goto Anovalue
    if not %A%=="" goto checkforA
    :Anovalue
    echo first word has no value
    pause
    if %B%=="" goto Bnovalue
    if not %A%=="" goto checkforB
   :Bnovalue
   echo second word has no value
   pause
   goto start
   :checkforA
   findstr /c:"%A%" xy.txt > NUL
   if ERRORLEVEL 1 goto notexistA
   if ERRORLEVEL 2 goto existA
   :checkforB
   findstr /c:"%B%" xy.txt > NUL
   if ERRORLEVEL 1 goto notexistB
   if ERRORLEVEL 2 goto existB
  :existA
  echo first word does exist in xy.txt
  pause
  goto checkforB
  :existB
  echo second word does exist in xy.txt
  pause
  goto start
  :notexistA
  echo first word does not exist in xy.txt
  pause
  (echo %A%) >>xy.txt
  goto checkforB
  :notexistB
  echo second word does not exist in xy.txt
  pause
  (echo %B%) >>xy.txt
   goto start\
我不能以更简单、更聪明的方式做到这一点吗?