Solved Check default internet browser with batch file?

March 25, 2014 at 09:14:02
Specs: Windows 7 Professional, 3.6GHz 16GB
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
)

If infinity is infinite, is the square root of infinity infinite as well?
- Kurp Von Steiner

message edited by RainBawZ


See More: Check default internet browser with batch file?

Report •

#1
March 25, 2014 at 14:47:49
✔ Best Answer
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


Report •

#2
March 26, 2014 at 05:26:12
Is there a way to make it only output the .exe filename/process name? That's the thing I need. I couldn't make a for loop that extracts the filename from the path given by the reg query (not very good with FOR loops).

If infinity is infinite, is the square root of infinity infinite as well?
- Kurp Von Steiner


Report •
Related Solutions


Ask Question