Tuesday, October 6, 2015

Windows explorer right click "new" item and how it works

      The "New" Menu


There is not necessarily one good way to insert document types to the New menu; it depends on the type of document.

Windows searches for items in the registry at HKCR\.XXX where .XXX is the document extension, such as .bmp for Bitmaps, .xlsx for Excel 2007 Workbooks, .txt for Text Files, etc. For each one of these extensions, there is a ShellNew sub-key.

For documents that do not require predefined parameters, the ShellNew subkey contains a String Value named NullFile with no data. Text Files (.txt) and Bitmaps (.bmp) fall into this catagory.

For document types that do require predefined parameters, there must be a blank document of that type located at the %WINDIR%\ShellNew\ folder. The ShellNew subkey for that type must point to that file. Instead of having a String Value of NullFile with no data, it must contain a String Value of FileName that points to that file by name in the contained data. JPEG Files (.jpeg) and Excel Workbooks (.xlsx) fall into this category.

For example, to create a menu item for an Excel 2007 Workbook, there must be a blank workbook in the %WINDIR%\ShellNew folder (e.g. %WINDIR%\ShellNew\excel2007.xlsx). Then there must be a registry entry that point to this file:
[HKEY_CLASSES_ROOT\.xlsx\ShellNew]
"FileName"="excel2007.xlsx"


In newer office versions you won't find the ShellNew key directly under HKEY_CLASSES_ROOT\.xlsx
instead it is located in HKEY_CLASSES_ROOT\.xlsx\Excel.Sheet.12

The reason is that under HKEY_CLASSES_ROOT\.xlsx there is a key:
(default)=Excel.Sheet.12

which tells windows to search of the ShellNew key under Excel.Sheet.12.

Likewise, the conventional way to disable items from the New menu is to rename the sub-key from ShellNew to ShellNew-, or to simply delete the key (with caution, of course).


(taken from 



(default)=Excel.Sheet.12

and it reappeared in the right click menu "new" items !

2 comments: