About   -   Contact   -   Purchase   -   Search   -   What's New

Adding Entries to the Explorer New Menu
You may have noticed that many programs add an entry to the New Menu in explorer to allow you to create a new empty file in any location. This is a great productivity benefit for users and developers alike. This tip shows you how to add your own entries to the menu for either your own use during your development efforts or to add this feature to your own programs for your own users. You may also be interested in the Associating Programs, Icons and Descriptions with File Types Tip.

This tip requires you to modify the registry, while experimenting it is always best to backup your registry before commencing to make sure you do not loose your complete OS. Now on with the tip where will will create a mapping for a new filetype/program called Ken amd Kens Editor.

The first thing you will need to do is to setup a file association for the program. If you are setting up a New item for an existing application then there will probably be an entry for the file type already. If you are setting up an entry for your own file type in your application follow these instructions:

  1. Open up the registry and look at the HKEY_CLASSES_ROOT, all the information about the default file types and mappings are stored here. You will need to add two entries to the root of this folder. Right click on the HKEY_CLASSES_ROOT folder and select New Key. Create a key with the same name as your file extension, for our example we will use .ken as our extension.
  2. Set the default value to the name of your application, for example we will user KenEdit.
  3. Now create a second key in the root of  HKEY_CLASSES_ROOT called the same name as your application we will use KenEdit again. NOTE These two names must match.
  4. Create a key named shell under the program name entry.
  5. Create a key named open under the shell key entry.
  6. Create a key named command under the open key entry.
  7. Set the default value for the command key to the name of the application that will edit the files, we will use WordPad for our demonstration so enter the full path to the WordPad program.

Now you should be able to double click on files with a .ken extension in explorer and have it open up the file in WordPad. So now on to adding the KenEdit application to the New menu:

  1. Create a dummy/empty file with the application that will create the new file types, for our example open up wordpad and type Ken as some text.
  2. Then Save the file to a directory called ShellNew under your windows directory as KenEdit.ken, you can call the file whatever you want but by convention we use the programs name and the correct file extension.
  3. Now go back to the registry and under the key for the file extension we created earlier called .ken create a new key called ShellNew.
  4. Under the ShellNew key create a string called FileName and set the value of the FileName to be the name of the empty file we created in step 2 KenEdit.ken.
  5. This is all you need to make the process work but to make things look a little slicker goto the KenEdit key we created in the root folder and set the default value for this key to be a nice name for your application we will user Kens Editor File.

Now goto explorer and right click, select new and you will have a new menu entry called Kens Editor File, select this option and you will get a new file called New Kens Editor File.ken double click on this file and word pad will open with the text Ken by default.

By automating this process as part of your application or install routine you can make the users life that bit easier or even on your own PC its great to be able to add this functionality to the applications that we use every day liek SQL Plus and the like.


Top of Page

Legal Notice

Ken Howe 2011