Variable = %version%
This variable contains this = 5.13-update_01-01-2014
How can use the IF statement to check if the variable %version% contains the word 'update' ??
Thank you in advanced!
A simple demo using conditional statements.
Look at this post (dbenham's answer) for a similar question 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"
Cheers,G
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With