How do I associate a custom MIME-type to my local application in the major browsers?

别说谁变了你拦得住时间么 提交于 2019-11-30 00:39:19
Jason

It looks like it can be done via a registry change on windows.

[HKEY_CLASSES_ROOT\.atom]
    @="atom_file"

[HKEY_CLASSES_ROOT\atom_file]
    @="Atom Syndication Program"

[HKEY_CLASSES_ROOT\atom_file\shell]

[HKEY_CLASSES_ROOT\atom_file\shell\open]

[HKEY_CLASSES_ROOT\atom_file\shell\open\command]
    @="\"C:\\AtomHandler\\handle.exe\" %1"

[HKEY_CLASSES_ROOT\MIME\Database\Content Type\application/atom+xml]
    "Extension"=".atom"

Further reading on Windows...

And here's how to do so on Linux.

Use xdg-utils from freedesktop.org Portland

I often want to associate a new file type with being a text file. The safest and quickest way of doing this is:

A. Create the file type in Registry if it doesn't already exist

  • Windows -> Search for RegistryEditor -> Open
  • Right-Click HKEY_CLASSES_ROOT -> New -> Key
  • Name the key the same as the extension (e.g. .txttt)
  • Click on the newly created key (e.g. HKEY_CLASSES_ROOT -> .txttt) -> Right-click on (Default) in the right pane -> Modify -> Set to the following values:

(Default) REGSZ txtfile

  • Right-click on the newly created key (e.g. HKEY_CLASSES_ROOT -> .txttt) -> New -> String -> Set to the following values:

ContentType REG_SZ text/plain

  • Right-click on the newly created key (e.g. HKEY_CLASSES_ROOT -> .txttt) -> New -> String -> Set to the following values:

PerceivedType REG_SZ text

B. Associate the file type with a default program

  • Right-click on your file -> Open with -> Choose another app
  • Check "Always use to open with this program"
  • Select the default program

The new file type should open and preview in Windows Explorer with the default text editor program you selected.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!