Ver check & install

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Message
Author
Dipesh
Posts: 23
Joined: 13 Sep 2012 00:05

Re: Ver check & install

#16 Post by Dipesh » 01 Mar 2013 01:35

FOR /F "tokens=1-4 delims=." %%A IN ("%firefox%") DO SET "javaCompareVer=%%A%%B%%C"

this function remove dots.

What my point is after installing first time they need to exit second time by logic but it not...

it install every time...

mfm4aa
Posts: 70
Joined: 13 Feb 2013 14:02
Location: Europe

Re: Ver check & install

#17 Post by mfm4aa » 01 Mar 2013 16:29

You can create mathematical compareble version variables, e.g.

Code: Select all

@echo off &setlocal
set "firefox=19.0.1"
for /f "tokens=1-3delims=." %%i in ("%firefox%") do set "ht=000%%i"&set "tt=000%%j"&set "hh=000%%k"
set "ht=%ht:~-3%"&set "tt=%tt:~-3%"& set "hh=%hh:~-3%"
for /f "tokens=1*delims=0" %%i in ("$0%ht%%tt%%hh%") do set /a "javaCompareVer=%%j"
echo firefox:      : %firefox%
echo javaCompareVer: %javaCompareVer%
endlocal


output:

Code: Select all

firefox:      : 19.0.1
javaCompareVer: 19000001


Post Reply