Created
August 16, 2017 11:04
-
-
Save ksatirli/ba8c3927cd2e6a609c215dd8ebaf4c2f to your computer and use it in GitHub Desktop.
get Windows Browser versions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
:: BEGIN: ensure all variables stay local: | |
setlocal | |
:: BEGIN: define config variables: | |
set versions_file="versions.txt" | |
:: END: define config variables: | |
:: INFO: handle Microsoft Internet Explorer: | |
set query_internetexplorer=reg query "HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer" /v Version | |
set find_internetexplorer=findstr /I /L /C:"REG_SZ" | |
:: INFO: handle Mozilla Firefox: | |
set query_firefox=reg query "HKEY_LOCAL_MACHINE\Software\Mozilla\Mozilla Firefox" /v CurrentVersion | |
set find_firefox=findstr /I /L /C:"REG_SZ" | |
:: INFO: handle Apple Safari: | |
set query_safari=reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Apple Computer, Inc.\Safari" /v Version | |
set find_safari=findstr /I /L /C:"REG_SZ" | |
:: INFO: handle Google Chrome: | |
set query_chrome=reg query "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Uninstall\Google Chrome" /v Version | |
set find_chrome=findstr /I /L /C:"REG_SZ" | |
:: INFO: write JSON header: | |
@echo { > %versions_file% | |
:: INFO: write Internet Explorer data: | |
for /f "Tokens=2*" %%u in ('%query_internetexplorer%^|%find_internetexplorer%') do ( | |
@echo "internetexplorer":{"version":"%%v"}, >> %versions_file% ) | |
) | |
:: INFO: write Mozilla Firefox data: | |
for /f "Tokens=2*" %%u in ('%query_firefox%^|%find_firefox%') do ( | |
@echo "firefox":{"version":"%%v"}, >> %versions_file% ) | |
) | |
:: INFO: write Apple Safari data: | |
for /f "Tokens=2*" %%u in ('%query_safari%^|%find_safari%') do ( | |
@echo "safari":{"version":"%%v"}, >> %versions_file% ) | |
) | |
:: INFO: write Google Chrome data: | |
for /f "Tokens=2*" %%u in ('%query_chrome%^|%find_chrome%') do ( | |
@echo "chrome":{"version":"%%v"} >> %versions_file% ) | |
) | |
:: INFO: write JSON footer: | |
@echo } >> %versions_file% | |
:: END: ensure all variables stay local: | |
endlocal |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
(This was used in 2011, unsure if it still works at this point)