简体   繁体   中英

Internet Explorer 11 detection from Batch File

I would like to ask you if there is a way in a batch file to do the following:

1) Read Internet explorer version from the registry.

2) If internet explorer is less than version 11 pop up a message "you are running a different version of Internet explorer. Application will close" and then exit application after pressing a button;

3) If internet explorer is 11 or higher then pop up message "You are running Internet explorer 11 or higher";

A Reg file will then be imported from c:\\myfolder and then batch file should show up something like "Operation finished.Press one button to close window".

I know IE 11 places a hive called "svcVersion" in the following path

"HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Internet Explorer

I wonder if any of you might be help me how to "instruct" the batch file to read from the registry looking for that parameter and then do as above. Thank you very much indeed for your help. Meleena

This should do it:

@echo off
setlocal
cd /d %~dp0
set regquery=reg query "HKLM\Software\Microsoft\Internet Explorer" /v svcVersion
for /f "tokens=3" %%a in ('%regquery%') do (
  for /f "tokens=1 delims=." %%b in ("%%a") do (
    if %%b LSS 11 echo you are running a different version of Internet explorer. Application will close & goto :eof
    if %%b GEQ 11 (
       echo You are running Internet explorer 11 or higher.
       echo REGEDIT /S C:\myfolder\myfile.reg
       echo Operation finished. Press any key to close window.
       pause>nul
    )
  )
)

Remove the echo before regedit after you change myfile.reg the the correct name.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM