Q. How can a script open a URL using your default browser?

Jerold Schulman

July 31, 2006

1 Min Read
ITPro Today logo in a gray background | ITPro Today

My first thought was to extract the default browser from the default text string at HKEY_CLASSES_ROOThtmlfileshellopencommand, using:

for /f "Tokens=3*" %%a in ('reg query HKCRhtmlfileshellopencommand /VE^|find "REG_SZ"') do (  set browser=%%b)

until I realized that the Start command would open a URL using the default browser.

I have scripted OpenURL.bat to open a specified URL in your default browser.

The syntax for using OpenURL.bat is:

OpenURL URL

Where URL is the URL of the page you wish to open, like HTTP://WWW.JSIFAQ.COM or WWW.JSIFAQ.COM.

OpenURL.bat contains:

@echo offif {%1}=={} @echo Syntax: OpenURL URL&goto :EOFStart /MIN %1


Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like