Home » Questions » Computers [ Ask a new question ]

Start default browser with its default search engine from Windows command line

Start default browser with its default search engine from Windows command line

Is it possible from the Windows command line to both:

Asked by: Guest | Views: 276
Total answers/comments: 1
Guest [Entry]

"I'm afraid this is not possible. Starting a specified URL with the default browser is easy enough using

start http://some/url

Querying the default search engine, however, is not that easy since different browsers tend to store it in vastly different locations if anywhere accessible at all. Internet Explorer for example stores its search engines in

HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\SearchScopes

but Firefox and others probably store it in different locations (I mean, a single unified location for settings common to all browsers would be convenient for users but developers would hate it, especially if that would be a single unified location dictated by Microsoft).

You might try different code paths to determine the default search engine depending on the default browser. But the default browser is also only loosely specified and could be obtained by looking which program is associated with the HTTP protocol handler.

But that borders dangerously close to guessing, with ginormous amounts of work on the other side of the cliff. So in general I'd say it's nearly impossible unless you pur more work into it that you likely want.

ETA: Some browsers, such as Firefox allow for searching directly from the command line, using the default search engine:

firefox.exe -search keyword

or

opera.exe ? keyword

But this still leaves you with the problem of figuring out the default browser and determining the appropriate arguments from that."