I need to get version of a file but then I need to use just a part of it in order to perform some further actions (e.g. compare it and continue according to the result).
Example: File version is 17.5.834.0, what I need to get and use is just the 834 number.
I use the following to get the number and work with it:
@echo off
if exist "c:\Program Files\myprg\myfile.exe" SET prgfolder=c:\Program Files\myprg
for /f "usebackq delims=" %%a in (`"WMIC DATAFILE WHERE name='%prgfolder:\=\\%\\myfile.exe' get Version /format:Textvaluelist"`) do (
for /f "delims=" %%# in ("%%a") do set "%%#"
)
echo %version%
if %version% gtr 17.5.3000.0 echo Hello World
The echo prints the whole number and when it is e.g. 17.5.834.0 then it does not work with the if gtr 17.5.3000.0
. My idea was to extract just the third number and adjust the IF then. Thank you in advance for any tip.