This trick will let you add items to the New context menu. This requires some knowledge of the registry.
The HKEY_CLASSES_ROOT hive of the registry contains information that lets Windows determines how to handle particular file types. Default open and edit options, open with choices, and context menu handlers.
The ShellNew key can be added to virtually any extension in this hive which will add that particular file type to the new context menu.
Here's the format of the Key needed to accomplish this.
[HKEY_CLASSES_ROOT\.ext\ShellNew]
"Value"="data"
.ext determines the file type you want to add to the New Menu.
Value determines exactly how the context handler will create the new file in question. There are 4 possible value types that can be used:
"NullFile"="": Creates a blank document where the New file was selected.
"FileName"="Filename": Creates a new document which contains the contents of the template file stored in \Windows\ShellNew.
"Command"="path\command": Executes a program. This one is my favorites.
"Data"="text to be placed in new document": Creates a new document which contains the text assigned to the value data.
Here are some examples:
Create an empty Batch file:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\.bat\ShellNew]
"NullFile"=""
- Windows Registry Editor Version 5.00
- [HKEY_CLASSES_ROOT\.bat\ShellNew]
- "NullFile"=""
Create a new registry file with the obligatory text,
Windows Registry Editor Version 5.00 at the beginning:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\.reg\ShellNew]
"Data"="Windows Registry Editor Version 5.00"
- Windows Registry Editor Version 5.00
- [HKEY_CLASSES_ROOT\.reg\ShellNew]
- "Data"="Windows Registry Editor Version 5.00"
Launch your html editor of choice when Selecting New HTML document:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\.html\ShellNew]
"command"="\"program path\\program name\" \"template path\\template file\""
- Windows Registry Editor Version 5.00
- [HKEY_CLASSES_ROOT\.html\ShellNew]
- "command"="\"program path\\program name\" \"template path\\template file\""
This last one is a bit more tricky. The extra quotes are necessary when the path names contain spaces such as
C:\program files\.... The \ character is necessary when including the extra quotes inside of the quoted registry data. You may also use system variables such as %programfiles% or %systemroot%. If the values assigned to these particular variables contain spaces, then the extra quotes are still required. Double \\ are also necessary when defining paths to your program.
To create a new blank document and launch your program of choice, use the "%1" variable after your program name. Example:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\.txt\ShellNew]
"Command"="\"%programfiles%\\Crimson Editor\\cedt.exe\" \"%1\""
- Windows Registry Editor Version 5.00
- [HKEY_CLASSES_ROOT\.txt\ShellNew]
- "Command"="\"%programfiles%\\Crimson Editor\\cedt.exe\" \"%1\""
This will launch crimson editor and create a blank document at the location the new text file was selected.
Here is an example that I use to launch HTML-Kit with my default HTML and CSS document:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\.html\ShellNew]
"Command"="\"%programfiles%\\Chami\\HTML-Kit\\Bin\\HTMLKit.exe\" \"C:\\templates\\New.css\" \" C:\\templates\\New.html\""
- Windows Registry Editor Version 5.00
- [HKEY_CLASSES_ROOT\.html\ShellNew]
- "Command"="\"%programfiles%\\Chami\\HTML-Kit\\Bin\\HTMLKit.exe\" \"C:\\templates\\New.css\" \" C:\\templates\\New.html\""
Of course, you can use RegEdit to add these entries directly. The extra quotes and slashes are not necessary when using regedit to edit your data.
This should give you a general idea of what can be done in the way of new context menu entries. As always, take care when editing the registry. These edits are fairly safe. The worst thing that happened when I made a mistake with one entry was that a program failed to launch. Still, use caution. Always back up your registry