bat 判断变量字符串中是否包含字符串
bat 判断变量字符串中是否包含字符串
@echo off rem way 1 set str=machine-order-service set matchStr=orderd echo %str% | findstr %matchStr% && echo yes || echo no rem end way 1 pause rem way 2 setLocal EnableDelayedExpansion if not "x!str:%matchStr%=!"=="x%str%" ( echo Y ) else ( echo N ) endlocal rem end way 2 pause

更多精彩