变量=%version%
此变量包含此= 5.13-update_01-01-2014
如何使用IF语句检查变量%version%是否包含单词' update '??
先谢谢你了!
答案 0 :(得分:3)
使用条件语句的简单演示。
查看这篇文章(dbenham的回答),找出类似的问题How to conditionally take action if FINDSTR fails to find a string
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"
干杯,G