For each file type, you can define a type handler:
; Create a new file type handler class and give it a description
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\SublimeText.txt]
@="Text File"
; Define the Icon to use for the file
; Note: This is optional. If not defined, the program icon will be used
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\SublimeText.txt\DefaultIcon]
@="\"%SystemRoot%\\system32\\imageres.dll\",-102"
; Define the default shell action (what to trigger when double clicked)
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\SublimeText.txt\shell]
@="Open"
; Declare the default action defined above (Open) and assign some text to the command
; Note: The text below (Edit) will be shown at the top of the right click menu for that type
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\SublimeText.txt\shell\Open]
@="Edit"
; Define the command for the "Open" action
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\SublimeText.txt\shell\Open\command]
@="\"C:\\Program Files\\Sublime Text\\sublime_text.exe\" \"%1\""
Technically, if you donât care about the file description or assigning custom icons to each file type, you can really just declare one file type handler. You should just need to replace âSublimeText.txtâ with something like âSublimeTextDocâ and assign default values for everything.
The second section defines basic display information for the application:
[HKEY_LOCAL_MACHINE\SOFTWARE\Sublime\SublimeText\Capabilites]
; Give the application a description
; This use to be view-able in the Control Panel, but I think it's no longer shown
"ApplicationDescription"="Sublime Text 3 - Text editor of the future!"
; Give a readable name to the program
; Shown in several places (Open with menu and such)
"ApplicationName"="Sublime Text 3"
; Icon to show for the program, generally next to the name (Open with menu and such)
"ApplicationIcon"="\"C:\\Program Files\\Sublime Text\\sublime_text.exe\",0"
The third section defines the file types the applications supports, and the handler to use:
[HKEY_LOCAL_MACHINE\SOFTWARE\Sublime\SublimeText\Capabilites\FileAssociations]
; Format: <File Type>=<File Handler>
".as"="SublimeText.as"
...
".txt"="SublimeText.txt"
So, if you created a generic âSublimeTextDocâ handler class, and you wanted sublime to open python files, you would add something like:
".py"="SublimeTextDoc"
Similarly, if you create a specific handler with a custom icon, you would replace SublimeTextDoc with your custom handler (SublimeText.py if you followed my pattern)
The final section tells Windows where you find the program information. This effectively adds Sublime to the âOpen Withâ menu and such.
[HKEY_LOCAL_MACHINE\SOFTWARE\RegisteredApplications]
"Sublime Text 3"="Software\\Sublime\\SublimeText\\Capabilites"
As a side note, the âDefaultIconâ from the sample reg file isnât what I actually use. I generally use a bunch of icons provided by Visual Studio, which looks like a basic white rect with the extension overlayed. Since everyone doesnât have VS, I replaced the custom icon with more generic stuff.