Add items to the New menu (aka ShellNew entries)Published: July 06, 2004
Send your feedback
When you open the File menu in Windows Explorer, the first command is New. Selecting this command displays a submenu. By default, it contains two commands, Folder and Shortcut, that allow users to create subfolders and shortcuts. This submenu can be extended to include file creation commands for any file class. Tweak UI allows you add or remove unwanted Shellnew entries.
Adding a ShellNew entry manually
To add one manually, follow the procedure explained in this article . (HTM file taken as example). To add the "New HTML document" to the New sub-menu, open Registry Editor and navigate to:
Create a new key named ShellNew
In the right-pane, create a REG_SZ (String Value) named NullFile
Close Registry Editor and restart Windows. The "HTML Document" will appear in the sub-menu. When you choose "HTML Document", a 0 byte file named "New HTML Document" appears in that folder. The file is 0-byte because you've created the REG_SZ named NullFile.
Sometimes, you may want Windows to populate few lines in the newly created file (such as a standard Header/Footer or the Company Logo). In that case, you may choose "Data" or "FileName" values, rather than "NullFile" (refer to the table below)
As given in the MSDN Library
|Command||Executes an application. This is a REG_SZ value specifying the path of the application to be executed. For example, you could set it to launch a wizard.|
|Data||Creates a file containing specified data. Data is a REG_BINARY value with the file's data. Data is ignored if either NullFile or FileName is specified.|
|FileName||Creates a file that is a copy of a specified file. FileName is a REG_SZ value, set to the fully qualified path of the file to be copied.|
|NullFile||Creates an empty file. NullFile is not assigned a value.|
Editor's Note: My test shows that the order or execution / Priority is as follows:
FileName | Command | Data | NullFile
If all of the above are used for a certain file type, the one with the top Priority is used, rest all is ignored.
If you're using the 3rd method (FileName) and not mentioning the full path of the sample file (or the template file), Windows looks for the file in these paths, in the same order given:
Browse to the above folder and you'll see that Office applications (Word, Powerpoint, Excel) have created the template files there already.
"New Shortcut" is an example where the first method is used (Command). Selecting the File New > Shortcut, actually runs this command:
rundll32.exe appwiz.cpl,NewLinkHere %1
As defined in this key:
Command = rundll32.exe appwiz.cpl,NewLinkHere %1