# Bach file version check IE



## OOge (Oct 24, 2012)

Hey, I'm trying to get a batch file created which checks the IE version and depending on the version it needs to install/register items.

How can I use batch to check which version of IE the computer has.


----------



## foxidrive (Oct 20, 2012)

Try this - it gets the version from the registry.


```
@echo off
Set RegQry="HKLM\Software\Microsoft\Internet Explorer" /v Version
REG.exe Query %RegQry% | Find /i "Version"> version.txt
```


----------



## OOge (Oct 24, 2012)

I will try this later on. I'm stuck at my old script right now. Maybe someone can help me sort this out. Guess I'm over looking the issue. Still get unexpected goto

:check
@echo off
set Key="HKEY_CURRENT_USER\Control Panel\International"
for /F "tokens=3" %%a in ('reg query %Key% ^| find /i "sLang"') do set Language=%%a
echo System Language is %Language%

if %Langauge%==ENG goto ENG
if %Language%==NLD goto NLD


:NLD
systeminfo | findstr /B "Naam van het Besturingsysteem">>c:\cleanSP.log 2>&1
systeminfo | findstr /B "Versie van het Besturingsysteem">>c:\cleanSP.log 2>&1
systeminfo | findstr /B "Geregistreerde">>c:\cleanSP.log 2>&1
systeminfo | findstr /B "Computer">>c:\cleanSP.log 2>&1
ECHO.>>c:\cleanSP.log 2>&1
systeminfo | findstr /B "Naam van het besturingsysteem" > %TEMP%\osname.txt
FOR /F "usebackq delims=: tokens=2" %%i IN (%TEMP%\osname.txt) DO set vers=%%i
goto SCRIPT

:ENG
systeminfo | findstr /B "OS Name">>c:\cleanSP.log 2>&1
systeminfo | findstr /B "OS Version">>c:\cleanSP.log 2>&1
systeminfo | findstr /B "System Manufacturer">>c:\cleanSP.log 2>&1
systeminfo | findstr /B "System Model">>c:\cleanSP.log 2>&1
systeminfo | findstr /B "Registered">>c:\cleanSP.log 2>&1
systeminfo | findstr /B "Time Zone">>c:\cleanSP.log 2>&1
ECHO.>>c:\cleanSP.log 2>&1
systeminfo | findstr /B "OS Name" > %TEMP%\osname.txt
FOR /F "usebackq delims=: tokens=2" %%i IN (%TEMP%\osname.txt) DO set vers=%%i
goto SCRIPT


----------



## foxidrive (Oct 20, 2012)

Apparently it isn't the entire script, but you have goto script and no :script label in the above.


----------



## OOge (Oct 24, 2012)

Didn't think the complete script was needed as the rest works fine, it is only this section with issues
What happens is that if langauge = x it is not going to the langauge label.
IF I put NLD on top it goes to the NLD label, but if I put ENG on top, it still goes to NLD. So it seems the goto is not working.


----------



## foxidrive (Oct 20, 2012)

I see. The issue might be that the language variable is always NLD. Or it is not ENG or NLD - Maybe the case is different.
Try the following:

if %Langauge%==ENG goto ENG
if %Language%==NLD goto NLD
echo %Langauge%
pause
goto :different_language


----------



## foxidrive (Oct 20, 2012)

My english Win7 says this:

System Language is ENA


----------



## OOge (Oct 24, 2012)

Mine says ENU.. I changed that in the script, but copy/paste the old one ...nevertheless it is still not using the goto properly.


----------



## foxidrive (Oct 20, 2012)

The problem is not in the goto. try this and examine the language variable for both languages.

It also has to catch machines that are not either of the choices, or it will merely go to the first choice after the compare - hence the goto after the compare and which you need to implement.


```
echo "%Langauge%"
pause
if %Langauge%==ENG goto ENG
if %Language%==NLD goto NLD
goto :different_language
```


----------

