Windows browser command line

How to open chrome from command line

Chrome browser supports opening from command line and run window. There are few command line switches as well that you can use to launch chrome incognito mode or with other features.

Open chrome from command line

Run below command to start chrome from CMD.

Run command for Chrome

Chrome can be opened from Run window by executing the command chrome .

Note that the run command is chrome whereas the CMD command is start chrome

However, you can make it work from CLI too by adding the chrome installation folder to the PATH environment variable. The installation path is «c:\Program Files (x86)\Google\Chrome\Application» . You can add this folder to the path by following the instructions from How to set path from command prompt

How to open Chrome as a different user

Use runas command to start chrome with the credentials of another user.

To start chrome as administrator of the system

Open a website in Chrome browser from command prompt

A website can be opened from command line by specifying the URL of the website.

Run command for Chrome to open a website

Run the command chrome websiteUrl to open a website in chrome.

Open chrome in incognito mode from command prompt

Chrome has command line switch to open with incognito mode. This is supported from command prompt and run command.

Command to open chrome in incognito mode from CMD

Command to open incognito mode from Run

When setting path via command via instructions:
setx path “%path%;c:\Program Files (x86)\Google\Chrome\Application”

I still cannot run “chrome” via CLI
(c:\>chrome)

what am I missing?

Even manually adding it via sysdm.cpl I cannot get it to run

You need to open a new command window after running ‘setx’ command. In the first command window, it still uses the previous value of path.

I want to open website in a new window rather than a new tab in existing chrome window. could not figure out how to do this. Any ideas?

Windows command+ Browser bookmark

Kindly help is there any command to access browser bookmark via command line and open the bookmarked URL’s via command line or powershell or wmic.

Also is there any event in windows which tells when a bookmark was accessed.

Thanks in Advance.

1 Answer 1

Generally speaking, there is no event to let windows know that any browser executed or accessed a bookmark.
Normally the bookmarks are stored inside a file like «bookmarks.adr» or similar which contains all the information the browser has about the stored bookmarks (except thumbnail or favicon data). If you want to access the URLs and open them, you need to parse the bookmarks file and extract the URLs. Doing this on the commandline with batch only is tricky at least. unless you just need something simple like a findStr on http which would extract all those URLs beginning with http (check out findStr /? and type /? and try something like type bookmarks.adr | findStr http > urls.txt which needs to be processed further with a for loop maybe (check out for /? on the commandline).

PowerShell might get the job done more easily but I don’t know about the specific format of the bookmarks file and the browser you target. The browsers have their own format and thus the parsing is different for each browser class (maybe it is more unified than I am aware of, since most browsers are based on Chromium nowadays and therefore certainly share the same bookmarks file format).

Hope this helps. Good Luck with your project 🙂

Change Default Apps, Browser or File Association via Command-line in Windows 10

In Windows 10, setting per-user file associations for a logged on user account has to be done only using Default Apps or the Open with dialog manually. If you try to change the user default registry entries using script or batch files, Windows 10 will reset the file association to Windows defaults, and you’ll see the annoying An App Default was Reset notification.

Читайте также:  Windows installer icon size

Microsoft says applications must not write to the UserChoice registry key which stores the user-default association settings. This is because the user must be in control, not the programs. Programs competing with each other and arbitrarily changing the user-specific associations is not going to be good user experience. The UserChoice key is a protected location, and the ProgID value is validated with a hash.

When you use Default Apps or Open with to set associations, Windows 10 generates the hash for each file type association. The hash generated is based on many inputs like user account SID, ProgId, registry time, etc., and perhaps other parameters.

Default Browser & File Association via Command-line in Windows 10

Users may sometimes need a shortcut method to set file associations for their user account without going through the Open with dialog or Default Apps every time. Some toggle switch or shortcut to change browser or file association defaults will be a great help for users.

Luckily, we have the SetuserFTA tool to do that. To set the file association and default browser via command-line, use the SetuserFTA utility written by Christoph Kolbicz. Kolbicz has reverse-engineered the hashing algorithm effectively. This utility generates the hash automatically and sets the defaults for you.

To change the default browser using command-line, use this syntax:

It also supports URL protocols (e.g., http , https , mailto , etc.)

Google Chrome

To set Chrome as the default browser, run these commands:

Firefox

Opera

Microsoft Edge

RELATED: See article How to Remove File Type Associations Using the Registry Editor for more information on File extension → ProgID mapping.

Default Image Viewer

To set Windows Photo Viewer as the default handler for .png and .jpg files, run:

Note that you’ll have applied the Windows Photo Viewer registry edit as in the article Restore Missing Windows Photo Viewer in Windows 10 for the above commands to work. Without the necessary ProgId registration, your files will show up as unknown file type.

To revert to Microsoft Photos as the default, use this command-line:

ProgID vs “Applications\program.exe”

If an application doesn’t define a file class or Progid, you can mention the program’s exe as well, like Applications\program.exe type as well. This works if the program is registered under HKCR\Applications registry key.

For example, to set Notepad++ as the default editor for .txt files, run:

To revert to default ( notepad.exe ), use:

You may create desktop shortcuts for the required commands to switch defaults quickly in a single click!

View current user defaults for all file types

To get the user defaults for all file types and URL protocols, run the command:

SetuserFTA makes the job of setting file associations easy.

Note: There is a similar utility from Danysys.com which I’ve not tested yet. If you want to check it out, visit Set File Type Association Default Application Command Line Windows 10 UserChoice Hash Internal Method

One small request: If you liked this post, please share this?

About the author

Ramesh Srinivasan founded Winhelponline.com back in 2005. He is passionate about Microsoft technologies and he has been a Microsoft Most Valuable Professional (MVP) for 10 consecutive years from 2003 to 2012.

Microsoft → Windows → Windows 10 → Change Default Apps, Browser or File Association via Command-line in Windows 10

8 thoughts on “Change Default Apps, Browser or File Association via Command-line in Windows 10”

I’m just a user, not a geek techie! All this crap is meaningless to almost all of us. I’ll have
to hire some body in order to be able to use a $1200 computer!

The program doesn’t appear to work, or the instructions don’t cover the most common cases. For example, how do I assign .jpg files to be opened by “C:\Program Files (x86)\IrfanView\i_view32.exe”?

None of the following work, but none of them display any error message!
setuserfta jpg “C:\Program Files (x86)\IrfanView\i_view32.exe”
setuserfta .jpg “C:\Program Files (x86)\IrfanView\i_view32.exe”
setuserfta .jpg i_view32.exe
setuserfta .jpg application\i_view32.exe

The following gives an error message:
setuserfta .jpg application\”C:\Program Files (x86)\IrfanView\i_view32.exe”

@cdg: Try:
SetUserFTA.exe .jpg applications\i_view32.exe
SetUserFTA.exe .jpg applications\mspaint.exe

It’s “Applications” (not “Application”)

I’ve ben attempting to work with Microsoft Tech Support under my paid support subscription and so far no one at the Tier 1 or 2 level acknowledges that the chose default application Graphical User Interface (GUI) and Open with functionality is flawed. The above article’s mention that MS protects the file extension associations with a hash is enlightening. I suppose this is block malicious code from making changes…? I have to laugh that .pub files which are generated my Microsoft Publisher, and .msg files are not automatically recognized by the OS and associated with those applications. What’s more when I try to associate them the OS doesn’t present those applications as choices.

Читайте также:  Godex g500 драйвер windows

Think this is getting into AntiTrust areas with MS forcing only its view of valid apps being allowed to be associated.
Back to the days of bottling up IE to Windows and Governments bringing MS into court.

Unfortunately in most enterprise environments (where this is most useful), we are not able to download 3rd party unapproved apps.

Hey thanks for this article its great

One issue though: I setup 3 batch files to switch between Chrome, Edge and Firefox.
The first 2 work perfectly using the instructions as above.
i.e. if I click on a link in an email it opens Chrome or Edge immediately

But after running the Firefox batch file, if I click on the link in the email, it pops up a “How do you want to open this” dialog, with all the browsers listed.

What am I missing?

The bat file has this in it ( as per above)
SetuserFTA http FirefoxHTML
SetuserFTA https FirefoxHTML
SetuserFTA .htm FirefoxHTML
SetuserFTA .html FirefoxHTML

SetDefaultBrowser – Set the Default Browser per command line or script

UPDATE 20.02.2020 – Version 1.5 detects now Edge Side-by-side installations. How can i configure this

UPDATE 06.02.2020 – Version 1.4 adds support for Microsoft Edge Chromium

UPDATE 24.10.2018 – Version 1.3 is completely coded from scratch. New features: Supports ALL Browsers (any installed Browser, portable Browsers, App-V Browsers, AppData Browsers, etc.), start delay option added, full Unicode support, includes EULA.

UPDATE 16.12.2017 – Version 1.2 now supports Windows 8/8.1 and Server 2012/R2.

UPDATE 10.12.2017running Windows 1703 and newer, you can now use my SetUserFTA utility to change the default browser. Just make sure you set .htm. html, http and https properly.

if you are into XenApp, RDS or VDI, then you probably know how difficult it is to configure the environment properly for the enduser nowadays. in my latest blog article, i showed you how to configure File Type Associations per User. based on this previous work i have created a utility that can do the same for the Default Browser.

the story behind is pretty much the same, but to set a Browser, additional Registry Keys are needed (they are protected with the hash just like the file types). the only difference is, that Microsoft also checks the path of the Browser – on certain Windows builds. for that reason i decided to create a separate tool to make it as simple as possible.

newer windows builds don’t check the path of the browser anymore and therefore the hash changed too – but i have updated my tool to support following operating systems:

  • Windows 10 x86/x64 All Builds
  • Server 2016 Build 1607
  • Server 2019 Build 1809
  • Windows 8 and 8.1
  • Server 2012 and 2012 R2

if you want to know more about the technical details, please read my previous blog post.

how to use

its really simple. just run SetDefaultBrowser.exe in the user context (there is a list of possible ways in my previous blog) with the the hive and browser of your choice. Since the version 1.3 there are more parameters and it might look complicated, but it gives you actually much more flexibility. Just run SetDefaultBrowser without parameters to get a list of all available browsers:

as you can see, i have a ton of Browsers on my system and using the following examples i can change the default Browser:

  • SetDefaultBrowser.exe HKLM Firefox-308046B0AF4A39CB
  • this will set the x64 Firefox as my default
  • SetDefaultBrowser HKCU “Google Chrome.HEYY3KJOYOAJOPVCHWOFAPMTPI”
  • this will set the Chrome that is only installed in my AppData as my default
  • SetDefaultBrowser.exe Edge delay=1000
  • this will set Edge as my default browser, but will wait 1 second until it executes. delay must be provided in milliseconds.
  • SetDefaultBrowser.exe HKLM IEXPLORE.EXE group=IE_Users
  • this will set IE as my default Browser, if i am member of the IE_Users group

i hope these examples explain the possibilities and parameters clearly. if a browser identifier contains a space, you must use quotes – for example “Google Chrome”. the same applies to group names (but you also can use Domain\Group or group@yourdomain.tld).

to maintain limited compatibility with the older versions of SetDefaultBrowser, i have added shortcuts to the most used Browsers

  • SetDefaultBrowser.exe chrome
  • this will set Chrome as my default Browser, when its available in HKLM
  • SetDefaultBrowser.exe ie delay=2000
  • this will set Internet Explorer as my default Browser but delays two seconds before
  • SetDefaultBrowser edge group=EdgeUsers
  • this will make Edge the default if the user is member of the EdgeUsers group
Читайте также:  Системные требования для mac os snow leopard

available shortcuts are: chrome, ie, iexplore, edge and edgelegacy. i had to skip Firefox, since you can have multiple Firefox installations (for example x64 and x86, like on the screenshot above) and using the hive and browser parameter, you can better specify which one you want to set as default.

SetDefaultBrowser will also find the browser when it is not installed at the default path.

the easiest way in an enterprise environment is to use the Group Policy Logon Script feature (you need loopback mode activated, when deploying to computers) – but there are many other ways (check the SetUserFTA blog for more ideas).

IMPORTANT: a portable Browser must be registered in the registry first to work with SetDefaultBrowser. You can learn how to do that in my blog post.

additional info

if you still see this screen after you used SetDefaultBrowser:

then try this registry key (needs an explorer.exe restart or just a re-login):

this registry key also works with HKEY_CURRENT_USER!

or enable the GPO Do not show the ‘new application installed’ notification (Windows Components, File Explorer).

bugs? requests?

if you find a bug or have a special request, you can send me an email to bugs@ mydomain (the one in the browser address bar).

download

Version 1.0 – first public version
Version 1.0.1 – additional Firefox detection
Version 1.1 – now working on Windows 1703 and 1709, opera support added
Version 1.2 – support for Windows 8.x and Server 2012/R2 added
Version 1.3 – support for ALL Browsers, delay parameter, full Unicode, EULA
Version 1.4 – support for Microsoft Edge Chromium
Version 1.5 – allows Edge Side-by-side configurations

keep the project and this blog alive – please consider donating:

if you prefer cryptocurrencies, please contact me for details.

164 Comments

When I use the program together with a logon script Windows is resetting the default associations after a few seconds. Can you help me?

hey. what exactly do you mean by that? which associations? and how did you set them?

I ran the DefaultBrowser.exe with the argument ‘iexplore’. After I ran the .exe I can see the association for the protocol http. However after a few seconds Windows sets the association back to a default value and resetting my default browser.

ah… i see. which operating system? build?

I am using Server 2016 with build 1607 and version 14393.1944.

What I did was executing the .exe and registering the changes in the registry. After a while ‘explorer.exe’ resets the registry values of ProgId.

When I perform the .exe after login it is working. So it seems a setting or something within Server 2016 that resets the association.

i was going to ask that – because it works for me on the same build.

did you try to run it per GPO? or the Run registry key? do you use an AppAssoc.xml?

Well I am using a GPO -> Logon script. However there are some other GPOs involved. What could be resetting the setting?

I can provide a log or something?

Also something I need to mention: we are working on a Citrix environment.

I tried disabling different GPOs but unfortunately no effect so far.

I have some new information: when I adjust the logon script it changes the browser and the setting is not getting adjusted. However when I remove the profile from the server it does not set the default browser.

I see different operations from citrix accessing winhttp.dll. Is this a possible cause?

For my comment JANUARY 30, 2018 AT 11:45 AM: I mean that for the first time login the script is not working.
However if I do not remove the profile from the server and I logout and login again your .exe is working.
In our situation users login/logout on different servers. So every first time will result in not setting the default browser. What is your advice?

I know I keep replying but also I can see in procmon that the SettingSyncHost is accessing winhttp.dll and after that the ProgId gets a reset upon first time logon.

to which browser does it reset? because usually IE is the default already.

In this case I use chrome. It resets to a random value containing AppX….ky8 or something.

this would be edge – but its not available on Server 2016.

AppXq0fevzme2pys62n3e0fbqa7peapykr8v -> same value each time (also with different users).

I disabled the GPO recently. Shall I disable Edge?

there is no edge on server 2016. how would you disable it? its not installed at all. or do you have edge.

Indeed, I cannot find Edge.

GPO disabled still same result. No Edge present but same ProgId value appears every single time on first logon and first creation of the user profile folder.

Could Citrix do this? Or any other program perhaps? Looking for a cause but already had so many options disabled… xD

Оцените статью