Wednesday, 21 January 2015

Java-Fetch InternetExplorer Version

Java Program to fetch internet Explorer version.

import java.io.IOException;
public class Test {

    public static void main (String[] args) throws IOException {
        String IEVersioncmd = "reg query \"HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Internet Explorer\" /v svcVersion";
        System.out.println(execCmd(IEVersioncmd).split("REG_SZ")[1].trim());
     }
   
    @SuppressWarnings("resource")
    public static String execCmd(String cmd) throws java.io.IOException {
        java.util.Scanner s = new java.util.Scanner(Runtime.getRuntime().exec(cmd).getInputStream()).useDelimiter("\\A");
        return s.hasNext() ? s.next() : "";
    }   
}

Executing the above java program:

Output:
Note:
Verified the InternetExplorer version using above program on Windows OS for IE 10 and IE 11.

Internet Explorer Version in IE Browser.

No comments:

Post a Comment