批处理查找字符串,实现if else效果

转自:https://blog.csdn.net/xiaoding133/article/details/39253213

@echo off  

set str1=sxming.
echo %str1%|findstr "^sx" >nul  
if %errorlevel% equ 0 (  
echo ok  
) else (  
echo not ok  
)  
pause

没有更多推荐了,返回首页