How to change "OpenWith" user preference settings from cmdline?


Extraordinary Member
As you know some file may be opened by multiple installed programs.

Assume I have 3 picture viewers installed for viewing *.jpg files.

Currently the default program for opening these *.jpg is "aaa.exe"

In the future I want to let the *.jpg open (by double clicking in Windows Explorer) by a second program bbb.exe

Associating *.jpg extension with assoc and ftype does not help.
UserChoice has higher priority than default association.

So I need a way to modify the "OpenWith" User Preference as well.

I want such a modification by command line command and not by clicking through GUI.
Keep in mind that in reality I have to do this for a dozend of extension every time.

Putting commands in batch script would be helpful.

So again: How do I modify the "OpenWith" user preferences for lets say extension *.jpg to program bbb.exe from cmdline?

thank you


Windows Forum Admin
Staff member
Premium Supporter
To view/change associations via command line you'll need to look at assoc, and ftype commands.

For instance to create a new association and file type...
assoc .mytext=MyText
ftype MyText=notepad.exe %1 %*


Extraordinary Member

Please, read my initial posting carefully. I said that assoc and ftype does NOT help.
Thats because these commands have LOWER priority than User customized OpenWith preferences.

Thats exactly the reason why I want to change OpenWidth preferences and NOT the default ones.


Windows Forum Admin
Staff member
Premium Supporter
Ah yes I missed that bit, you are correct that user defined classes stored at HKEY_CURRENT_USER\Software\Classes will override this.
Therefore I would suggest using the command line "reg add" and "reg delete" to modify keys in that area (or possibly just nuking the association in there and then using ftype and assoc)


Extraordinary Member
Ok, thank you.

Is nuking directly in registry really the only way?

Is there no all-in-one-tool "change-ftype+assoc+openwith"

This website is not affiliated, owned, or endorsed by Microsoft Corporation. It is a member of the Microsoft Partner Program.