Microsoft

TechRepublic Tutorial: Add file types to Windows' New command menu

Add new file types to the New commands menu simply by creating a document template with your application that you then save to a special folder called ShellNew.


By default, the Windows operating system places the file types for most of the major applications that you install on the New command's menu. This allows you to easily create a new document of any of the registered file types simply by right-clicking in a folder or on the desktop and selecting the file type from the New command's menu.

For example, suppose you want to create a new Notepad document on the desktop. If so, you'd right-click the desktop, select the New command, and then simply select Text Document from the cascading menu. As soon as you do, a new file would appear on your desktop. All you would have to do is rename the file, making sure that you left the file extension in place, double-click the icon, and you’d be ready to begin creating your new document. What could be easier?

Unfortunately, the Windows operating system doesn't put all file types on the New menu for every application that you install. You can, however, add other file types to the New command's menu simply by creating a document template with your application that you would then save to a special folder called ShellNew. Once you create the template, you then need to edit the registry and add a special entry to the HKEY_CLASSES_ROOT key that references the template in the ShellNew folder.

In this Daily Feature, I'll show you step-by-step the entire procedure for adding new file types to the New command’s menu. As I do, I'll use an example to illustrate each step in detail.

Windows versions
This technique will work in Windows 9x, Windows Me, Windows 2000, and Windows XP. It should also work in Windows NT, but I was unable to test this technique on that operating system. If you’re running Windows NT, please post a message in the Discussion Center and let everyone know if the technique works with Windows NT.

An example situation
To make the procedure a bit easier to track, I’ll begin by setting up a quick example situation that I can use to illustrate the procedure. Suppose that you’re using NoteBook 2000, a shareware list editor from Software Design, to create a list of descriptions of the files in specific folders on a network-based file server. As you’re doing so, you’re creating new NoteBook documents in each folder that you’re working in. You’re creating many new NoteBook 2000 documents, and it would be very handy to be able to create new documents in each folder right from the New menu.

When you install NoteBook 2000, the installation procedure registers the NoteBook file type and extension (PAD) with the operating system so that you can easily launch NoteBook by double-clicking on any existing PAD file. However, it doesn't place the NoteBook file type on the New menu. Therefore, each time you want to create a new NoteBook document, you have to launch NoteBook, create a new file, and use the Save As dialog box to painstakingly locate the folder on the network-based file server in which you want to create the document.

Fortunately, you can avoid all this hassle by adding the NoteBook 2000 file type to the New command’s menu.

Creating the template
As I mentioned, the first thing that you need to do is to create a template and save it in the ShellNew folder. To begin, launch the application whose file type you want to add to the New menu, open a new blank document, and save it as a template file in the C:\Windows\ShellNew folder.

So for this example you would open NoteBook 2000 and create a template file by saving a blank document as New1.pad in the ShellNew folder, as shown in Figure A. Once you save the file, close the application.

Figure A
You'll save a blank document in the ShellNew folder in order to create a template.


Modifying the file type in the registry
Once you’ve created the template, you’ll be ready to edit the registry. To do so, open the Registry Editor and double-click the HKEY_CLASSES_ROOT key. When the entire branch is visible, you'll see that this main key contains a list of all the file types registered in the operating system, as shown in Figure B. Bear in mind that the list of file types contained in the HKEY_CLASSES_ROOT key is quite extensive and probably contains many file extensions that you’ve never heard of before. This is normal and shouldn’t cause you any concern.

Figure B
The HKEY_CLASSES_ROOT key lists all the file types registered in the operating system.


As you can see, each subkey contained in the HKEY_CLASSES_ROOT key is named after the file extension that it represents. This makes it easy to locate the correct key among all the listed file types.

To add a file type to the New menu, you'll add a new key and string value to the file type's key. You'll then assign the template file's path to the string value.

For example, to add the NoteBook 2000 file type to the New menu, scroll through the list and locate and select the .pad key, as shown in Figure C.

Figure C
The NoteBook 2000 file type's key has the same name as its file extension.


Now, pull down the Edit menu and select New | Key. When you do, the Registry Editor adds a new subkey beneath the .pad key and selects the default name—New Key #1—so that you can easily rename it, as shown in Figure D.

Figure D
The Registry Editor adds the new subkey beneath the .pad key.


At this point, type ShellNew in the text box and press [Enter]. Doing so adds the ShellNew subkey to the .pad key.

Now, pull down the Edit menu and select New | String Value. When you do, the Registry Editor adds a new value to the ShellNew key and again selects its default name—New Value #1. At this point, type FileName in the text box, as shown in Figure E, and then and press [Enter] twice.

Figure E:
You'll see the new value in the ShellNew key.


When you do, you'll see the Edit String dialog box. At this point, type the path to the New1.pad template file, which is located in the C:\Windows\ShellNew folder, in the Value Data text box, as shown in Figure F.

Figure F
You'll type the path to the template file in the Value Data text box.


Then, click OK. At this point, the Registry Editor will display the new subkey and value. To complete the procedure, close the Registry Editor. You may have to restart your system in order to activate the changes.

Implementing the technique
Once you add the file types to the New command's menu, you can easily create new NoteBook 2000 documents. To do so, simply select the file type from the New command’s menu, as shown in Figure G.

Figure G
Creating new NoteBook documents using the New menu is an easy procedure.


The Tweak UI method
If you’re familiar with Microsoft’s TweakUI PowerToy, you know that it too will allow you to add file types to the New command's menu, with the advantage of not having the edit the registry. However, the advantage of the manual technique that I’ve outlined here is that you don’t have to install a separate application, which is not officially supported by Microsoft, in order to perform the operation.

 

About Greg Shultz

Greg Shultz is a freelance Technical Writer. Previously, he has worked as Documentation Specialist in the software industry, a Technical Support Specialist in educational industry, and a Technical Journalist in the computer publishing industry.

Editor's Picks