Archive for April, 2021

Edit Windows file types with FileTypesMan

Wednesday, April 7th, 2021

To keep track of which programs should open which files, Windows uses a system with two basic units: file extensions, file types and actions. File extensions like .html and .txt are associated with a single file type, which is called things like ChromeHTML and txtfile. The file type includes a number of actions, such as Open and Edit, each containing a command string, which tells Windows how to open the file.

Back in Windows XP, the Explorer included a very useful dialog window in which you could manually edit the association between file extensions and file types, as well as the actions belonging to each file type. I personally used this extensively. Specifically, I like to customize the Edit menu item for various file types. For example, I could click Open on an HTML file to open it in my web browser and click Edit to open it in my HTML editor.

Unfortunately, this feature was removed from later versions of the Explorer. Many third-party alternatives have been developed, but the most powerful and reliable one that I’ve found is FileTypesMan by NirSoft. While initially a bit confusing, it is a very capable program, and I thought I’d share some tips about it in this post.

Installation

FileTypesMan doesn’t include an installer, but I prefer to extract the archive into %ProgramFiles%\NirSoft. Then, I run the following command in a command prompt with administrative rights:

mklink /j "%AppData%\Microsoft\Windows\Start Menu\Programs\Nirsoft" "%ProgramFiles%\NirSoft"

This creates a directory junction between the NirSoft folder and a new NirSoft folder in the current user’s Programs folder. This makes FileTypesMan easily accessible from the Start menu. Furthermore, the contents of the NirSoft folder will be included when I make a search from the Start menu.

Interface

FileTypesMan’s interface is divided into two sections: at the top, the list of all registered file types, and at the bottom, the list of all actions of the currently selected file type.

Main FileTypesMan window

You can search by file extension by typing anything while having the file type list selected. To search by other fields, use Edit Find (Ctrl-F). In the screenshot above, I’ve selected the .html file extension by typing .html (including the period). As you can see, it is associated with the ChromeHTML file type, which contains three actions: EditEdit2 and open.

Open and Edit are common actions, often defined by default, but I’ve added Edit2 myself. For ChromeHTML files, I’ve defined Edit to open KompoZer, my WYSIWYG editor, and Edit2 to open Notepad2, my plain-text editor.

Editing file types and actions

You can create a new action or edit an existing one by right-clicking in the action list. This brings up a menu where you define the internal action name, the menu caption (i.e. the text displayed in the Explorer’s right-click menu) and the command string describing how to open the file. Furthermore, you can copy and paste actions between multiple file types via the Copy Selected Actions option in the right-click menu.

Edit Action

The Edit Action window.

In the file type list, you can double-click a file extension/type in order to edit its properties. You can create a completely new file extension via Edit New File Extension (Ctrl-T).

Edit File Type

The Edit File Type window.

Creating new file types

The only thing that FileTypesMan can’t do is to create new file types per se.  It can create new file extensions, to which actions can be attached as well, but not new file types. Fortunately, it’s fairly simple to create a file type manually. Just edit and apply the following .reg file:

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\YourInternalName]
@="NAME TO BE SHOWN IN EXPLORER"
[HKEY_CLASSES_ROOT\YourInternalName\shell]
[HKEY_CLASSES_ROOT\YourInternalName\shell\open]
[HKEY_CLASSES_ROOT\YourInternalName\shell\open\command]
@="PROGRAM WITH WHICH TO OPEN FILE \"%1\""

Then, you can associate your file extension with your new file type by right-clicking on it in FileTypesMan and selecting Replace File Type For Selected Extension.