ell*_*ell 5 if-statement batch-file
变量=%version%
此变量包含= 5.13-update_01-01-2014
如何使用IF语句检查变量%version%是否包含单词“ update ”?
谢谢高级!
一个使用条件语句的简单演示。
在这篇文章(dbenham的答案)中查找类似的问题,如果FINDSTR找不到字符串,如何有条件地采取措施
C:\>set variable=5.13_01-01-2014
C:\>(echo %variable% | findstr /i /c:"update" >nul) && (echo Variable contains the string "update") || (echo Variable does not have the string "update")
Variable does not have the string "update"
C:\>set variable=5.13-update_01-01-2014
C:\>(echo %variable% | findstr /i /c:"update" >nul) && (echo Variable contains the string "update") || (echo Variable does not have the string "update")
Variable contains the string "update"
Run Code Online (Sandbox Code Playgroud)
干杯