for /f "tokens=3" %%f in ('find /c /i "apples" "test.txt"') do set varMWG=%%f
REM echo %varMWG%
if %varMWG% EQU 1 (
@echo TRUE
) else (
@echo FALSE
)
如果找到字符串,我想回显变量行,而不是回显 TRUE 或 FALSE,如果找不到,我仍然回显 FALSE。
test.txt 包含
fdgsdf
hgsfrtgyr
apples
fdsgfghs
erwyuweu