I've been using the following bit of CMD code to check Edge versions, but the move from 99 to 100 seems to have thrown a wrench in the code.
FOR /F "Tokens=2*" %%G IN ('REG QUERY "HKLM\SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}" /V "pv" ^| FINDSTR "REG_SZ"') DO (IF %%H GEQ 100.0.1185.29 (ECHO Microsoft Edge is version %%H and does not require an update. & GOTO SomethingElse) ELSE (ECHO Microsoft Edge is version %%H and requires an update. & GOTO MSEdgeInstall))
It now thinks that, for example, 99.9.1150.30 is higher than 100.0.1185.29. Now if I were to remove the dots, it would realise that 999115030 was, in fact, smaller than 1000118529. There's something about the presence of dots and an additional digit that causes the calculation in cmd to fail.
Is there some clever way to resolve this, or do I have to essentially remove the dots from the registry query before comparing from now on?
CodePudding user response:
While Magoo's code errored out for me somewhere, or I'm just not clever enough to understand it, it did give me a good advice on comparing each number individually, so thank you for that Magoo. I'd upvote you but my rank's too low apparently.
What I came up with instead is the following:
@ECHO Off
SET "DesiredVersionColumn01=100"
SET "DesiredVersionColumn02=0"
SET "DesiredVersionColumn03=1185"
SET "DesiredVersionColumn04=29"
FOR /F "Tokens=3*" %%G IN ('REG QUERY "HKLM\SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}" /V "pv" ^| FINDSTR "REG_SZ"') DO (SET "CurrentVersionFull=%%G")
FOR /F "Tokens=1* Delims=. " %%G IN ('ECHO %CurrentVersionFull%') DO (SET "CurrentVersionColumn01=%%G" & SET "CurrentVersionColumnRemaining=%%H")
FOR /F "Tokens=1* Delims=. " %%G IN ('ECHO %CurrentVersionColumnRemaining%') DO (SET "CurrentVersionColumn02=%%G" & SET "CurrentVersionColumnRemaining=%%H")
FOR /F "Tokens=1* Delims=. " %%G IN ('ECHO %CurrentVersionColumnRemaining%') DO (SET "CurrentVersionColumn03=%%G" & SET "CurrentVersionColumn04=%%H")
REM These are just for show, not really needed:
ECHO Edge Full Version: %CurrentVersionFull%
ECHO Edge Version Without Dots: %CurrentVersionColumn01% %CurrentVersionColumn02% %CurrentVersionColumn03% %CurrentVersionColumn04%
REM Version Checking
ECHO Ensuring that Microsoft Edge is version