Computing Staff
  • 0

Check Default Internet Browser With Batch File?

  • 0

Is it possible to create a batch file that can check which internet browser is the default one? I am creating a script that exits once the web browser .exe file is terminated, though the process name is different from each browser. I am using this command to check if the process is running:

tasklist /nh /fi “imagename eq !defaultBrowser!” | find /i “!defaultBrowser!” > nul
if %ERRORLEVEL%==1 (
Echo Process is not running
)

Share

1 Answer

  1. quick and messy solution maybe

    @echo off
    reg QUERY HKEY_CLASSES_ROOT\http\shell\open\command /ve>info.txt
    TYPE info.txt |FindStr /R “Internet Explorer”>NUL
    If %ERRORLEVEL% EQU 0 echo Default Browser is Internet Explorer
    TYPE info.txt |FindStr /R “Chrome”>NUL
    If %ERRORLEVEL% EQU 0 echo Default Browser is Google Chrome

    Im sure there is a less lazy way. 🙂

    ::mike

    message edited by mikelinus

    • 0