Using batch file to enumerate through registry keys -


i'm trying query install location of installed software. each new version of creates it's own key in registry following pattern:

hklm\software\mysoftware\<version> 

example:

windows registry editor version 5.00  [hkey_local_machine\software\mysoftware\0.2.0] "installdir"="c:\\program files\\mysoftware" 

how can query installdir of latest version installed on computer?

@echo off setlocal enabledelayedexpansion regedit /e /s hklm\software\mysoftware c:\export.txt set version_candidate=000  /f "tokens=4,5,6 delims=\." %%a in ('type c:\export.txt ^|findstr /r "[0-9].[0-9].[0-9]"') (     if %%a%%b%%c gtr !version_candidate! set version_candidate=%%a%%b%%c  )  set version=%version_candidate:~0,1%.%version_candidate:~1,1%.%version_candidate:~2,1% regedit /e /s hklm\software\mysoftware\version c:\export2.txt  /f "tokens=2 delims==" %%a ('type c:\export2.txt ^|find /i "installdir"') (     set i_dir=%%a ) echo %i_dir% endlocal 

rather guess can't know how registry entries like.


Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -