1、find
set tmp=TESTecho %tmp%| find "TEST">nul
if %errorlevel% equ 0 (echo find) else (echo not find)
2、findstr 比find更强大,支持正则表达式
set tmp=TEST/log
echo %tmp%|findstr "log$">nul
if %errorlevel% equ 0 (echo find) else (echo not find)
参考:
http://www.tuicool.com/articles/3IbMRzJ
http://www.cnblogs.com/doit8791/archive/2012/05/21/2511080.html