Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Is there a way to determine IE version at command level?

3,267 views
Skip to first unread message

justaguy

unread,
Nov 26, 2013, 10:20:34 AM11/26/13
to
Hi all,

I have a need to know a user's IE version at command level, and have looked at "C:\Program Files\Internet Explorer\" directory, it does not seem to have a utility like iever.exe something, but some of you may have an idea... so, I'm asking here...

And yes, to cover OS of win 7 and 8.

Many thanks.

Martin Heller

unread,
Nov 26, 2013, 11:11:08 AM11/26/13
to
justaguy wrote, on 26-11-2013 16:20:
> I have a need to know a user's IE version at command level

I'm on XP, but this works for me:

reg query "HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer" /v
version

contrex

unread,
Nov 26, 2013, 1:31:44 PM11/26/13
to
Win 7

C:\>for /f "skip=2 tokens=1-3 delims= " %A in ('reg query "HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer" /v version') do @echo %C
9.11.9600.16428

C:\>

justaguy

unread,
Nov 26, 2013, 3:13:59 PM11/26/13
to
You're a genius, it works great even for Windows 7. In the meantime, version must be on the same line with /v

I would hope it would work for Windows 8.x as well.

Many thanks.

justaguy

unread,
Nov 26, 2013, 3:14:58 PM11/26/13
to
Is this simply another way to solve the problem? Many thanks.

justaguy

unread,
Nov 26, 2013, 4:46:29 PM11/26/13
to
Now, I attempted to map its output to findstr command with i switch, however I didn't get what I needed, what's wrong?
@echo off
rem XP
reg query "HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer" /v version | findstr /i "9.11." >nul
REM debug
ECHO.%ERRORLEVEL%
if %ERRORLEVEL%==0 goto found
if %errorlevel%==1 goto notfound

:found
echo "found"
pause

:notfound
echo "not found"
pause


Many thanks.

Frank Westlake

unread,
Nov 26, 2013, 5:18:49 PM11/26/13
to
2013-11-26 13:46, justaguy:
> Now, I attempted to map its output to findstr command with i switch, however I didn't get what I needed, what's wrong?

It's FINDSTR. Use the other version you were given by Contrex(?):

for /f "skip=2 tokens=1-3 delims= " %A in ('reg query "HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer" /v version') do @echo %C

Double the percent signs for within a script and change the 'echo %%C' to 'Set version=%%C'. Then you can examine the resulting variable more thoroughly.

> :found
> echo "found"
> pause
>
> :notfound
> echo "not found"
> pause

':found' will continue through to ':notfound' after the PAUSE.

Frank


Todd Vargo

unread,
Nov 26, 2013, 7:39:41 PM11/26/13
to
On 11/26/2013 3:14 PM, justaguy wrote:

>>
>> C:\>for /f "skip=2 tokens=1-3 delims= " %A in ('reg query "HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer" /v version') do @echo %C
>>
>> 9.11.9600.16428
>>
>>
>>
>> C:\>
>
> Is this simply another way to solve the problem? Many thanks.
>

If desired, it permits you to store the value in a variable.

--
Todd Vargo
(Post questions to group only. Remove "z" to email personal messages)

justaguy

unread,
Nov 26, 2013, 10:13:58 PM11/26/13
to
Ok, thanks.

Now, here's the new code:
Line 1: @echo off
Line 2: for /f "skip=2 tokens=1-3 delims= " %%A in ('reg query "HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer" /v version') do Set version=%%C
Line 3: echo %version% | findstr /i "9.11."

But Line 3 does not return the result if the value of the var of version contains "9.11.". How come?

justaguy

unread,
Nov 26, 2013, 10:14:21 PM11/26/13
to
Thanks.

foxidrive

unread,
Nov 27, 2013, 12:38:46 AM11/27/13
to
On 27/11/2013 14:13, justaguy wrote:
> Now, here's the new code:
> Line 1: @echo off
> Line 2: for /f "skip=2 tokens=1-3 delims= " %%A in ('reg query "HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer" /v version') do Set version=%%C
> Line 3: echo %version% | findstr /i "9.11."
>
> But Line 3 does not return the result if the value of the var of version contains "9.11.". How come?

Yes it does, try this:


set version=9.11.1234567890

Frank Westlake

unread,
Nov 27, 2013, 9:06:00 AM11/27/13
to
2013-11-26 19:13, justaguy:
> Now, here's the new code:
> Line 1: @echo off
> Line 2: for /f "skip=2 tokens=1-3 delims= " %%A in ('reg query "HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer" /v version') do Set version=%%C
> Line 3: echo %version% | findstr /i "9.11."
>
> But Line 3 does not return the result if the value of the var of version contains "9.11.". How come?

It should -- perhaps the machine you are testing this on doesn't have
that version.

You might have another problem with FINDSTR later because you are
testing with a regular expression and the '.' represents any character.
So "9.11." will match "9.10.9911.16721" and many other strings. Use
either of these:

FINDSTR /C:"9.11."
FINDSTR /L "9.11."

But a better method which uses less CPU would be to make all your tests
with built-in commands and to not use FINDSTR, which is an external
command. Something like this:

For /F "skip=2 tokens=1-3 delims= " %%A in (
'reg query "HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer" /v version'
) Do Set "version=%%C"

If /I "%version:~0,5%" EQU "9.11." (
REM Do version 9.11 stuff.
) Else If /I "%version:~0,5%" EQU "9.10." (
REM Do version 9.10 stuff.
)

Etcetera. Another way which might be more useful is to set the version
and subversion into separate variables for more control. Something like
this:

For /F "skip=2 tokens=1-3 delims= " %%A in (
'reg query "HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer" /v version'
) Do (
For /F "tokens=1,2 delims=." %%D in ("%%C") Do (
Set "version=%%D"
Set "subVersion=%%E"
)
)
If %version% EQU 9 (
Echo Do things for version 9.
If %subVersion% EQU 10 (
Echo Do things for version 9 subversion 10.
) Else If %subVersion% EQU 11 (
Echo Do things for version 9 subversion 11.
)
)

In the above, something is done for all version 9 and different things
are done additionally for the subversions. I've been applying the term
"subversion" but I really don't know what it is in this case.

Frank

justaguy

unread,
Nov 27, 2013, 10:21:28 AM11/27/13
to
Ok, I'd like to achieve a simple solution first.
Regarding
FINDSTR /C:"9.11."
FINDSTR /L "9.11."
the first option created "/C ignored error REM fyi, I'm on Windows 7 Prof.
the second one returns 9.11.9600.16428

I was expecting 0 or 1. Now, I have assumed that 9.11. would indicate that the IE version is 11, is that correct?

Many thanks.

justaguy

unread,
Nov 27, 2013, 10:22:51 AM11/27/13
to
So, why it didn't return the correct/expected result for me? Any idea?
Thanks.

Frank Westlake

unread,
Nov 27, 2013, 10:40:02 AM11/27/13
to
Why do you repost all of the article you are replying to? This isn't an e-mail help-desk -- all previous messages are easily found in the tree and
repeating the entire content makes it hard to find your message.

2013-11-27 07:21, justaguy:
> FINDSTR /C:"9.11."
> FINDSTR /L "9.11."
> the first option created "/C ignored error REM fyi, I'm on Windows 7 Prof.

I recall seeing that error message before but I can't recall what causes it.

> the second one returns 9.11.9600.16428
> I was expecting 0 or 1.

Expecting 0 or 1 where? As an ERRORLEVEL?

> Now, I have assumed that 9.11. would indicate that the IE version is 11, is that correct?

I haven't known my IE version since 3, so I don't know how MicroSoft has built that version string.

Frank

foxidrive

unread,
Nov 27, 2013, 10:42:02 AM11/27/13
to
Sorry to be so brief.

It's plain that your string that was returned didn't have 9.11 in it. I tested the code here and it
works fine.

You may get better help if you outline what you expect it to do, or what you want the code to do.

foxi

0 new messages