Create a new "New" submenu in context menu with a custom name

I like to experiment a lot with coding and creating html, css, js etc. files each time I want to try something is tiring. To get around this, I have created template html, css, etc. files and added them into "New" in context menu (How can I add an item to the 'new' context menu?).

Currently, I've added 4 items; html, css, js, and php. "New" submenu got a little crowded. Now I'm thinking if it's possible to create a new submenu with a custom name (e.g. "Coding") that I can add these files. Actual "New" submenu would be less crowded and I could access these coding files easily under a new submenu.

A second thought, this new submenu doesn't necessarily have to be just right in the context menu. It can be inside the "New" menu. I just want to group these four files.

Worst case scenario, can I reorder the "New" submenu? I'd like to stack these four at the top or at the bottom.

enter image description here


Update: I've created a repository for this functionality. Feel free to check it out.


I've been searching for a solution to this, but the closest thing I came up with to what I want is adding a new item to the context menu which calls a script that makes a copy of a template file.

This isn't really what I want, but this might give someone an idea, so I'll post this anyway.

First, I searched for a way to add an item to the context menu. For example, Command Prompt. Following registry key does the job.

Windows Registry Editor Version 5.00

; Directory\Background\shell => on empty space

[HKEY_CLASSES_ROOT\Directory\Background\shell\cmd]
"Icon"="cmd.exe,0"
@="Command Prompt"

[HKEY_CLASSES_ROOT\Directory\Background\shell\cmd\command]
@="cmd.exe"

; Directory\shell => on a folder

[HKEY_CLASSES_ROOT\Directory\shell\cmd]
@="Command Prompt"
"Icon"="cmd.exe,0"

[HKEY_CLASSES_ROOT\Directory\shell\cmd\command]
@="cmd.exe /k cd %1"

Next, I want to add an item that creates a file, e.g., a CSS file.

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\Background\shell\CSS]
@="Cascading Style Sheet Document"
"Icon"="%SystemRoot%\\SysWow64\\SHELL32.dll,69"

[HKEY_CLASSES_ROOT\Directory\Background\shell\CSS\command]
@="C:\\Windows\\CustomNew\\css.bat"

Similar to Command Prompt registry key, this will add an item to the context-menu, but instead of running an application, it calls a bat file. Content of the bat file:

@echo off

copy C:\Windows\ShellNew\css.css %cd%

rename css.css "New Cascading Style Sheet Document.css"

I have a css.css template file in C:\Windows\ShellNew. I simply make a copy of the template file in the directory where I right click and choose Cascading Style Sheet Document.

enter image description here

Of course, I'll not use this method. This just complicates things even more. Imagine having all bat, css, html, js, and php files right in the context menu. I still need a better solution.


Update:

I may have found a solution. Original article: Add Cascading Menus for Programs in Desktop and My Computer Context Menus in Windows 7 and Later - AskVG

Adding the custom menu to the context-menu:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\Background\shell\Coding]
"Icon"="C:\\Windows\\CustomNew\\coding.ico"
"MUIVerb"="Coding"
"SubCommands"="cmd;css;html;js;php;bat"
"Position"="Top"

For this menu to work, we need to define these commands cmd, css, html, etc. For example, defining the Command Prompt:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\cmd]
@="Command Prompt"
"Icon"="cmd.exe,0"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\cmd\command]
@="cmd.exe"

Clicking on Command Prompt on the menu will run cmd.exe. This is straightforward. Tricky part is adding an item/app that creates a new file.

Let's start with a CSS file. Following registry will add the item to the menu.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\css]
@="Cascading Style Sheet Document"
"Icon"="%SystemRoot%\\System32\\shell32.dll,-151"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\css\command]
@="C:\\Windows\\CustomNew\\css.bat"

While we have a new item with the name "Cascading Style Sheet Document", clicking on it, normally, wouldn't do anything. To make it create a new file in the current folder, we call a script.

I have prepared a batch script for each file type that I want to create; bat.bat, css.bat, html.bat, etc. and placed them in C:\Windows\CustomNew. Also I have placed the template files bat.bat, css.css, html.html, etc. in C:\Windows\ShellNew.

So whenever I click "Cascading Style Sheet Document" on the menu, I call the css.bat which makes a copy of the css template file and places it in the current folder.

css.bat file:

@echo off

copy C:\Windows\ShellNew\css.css "%cd%"

rename css.css "New Cascading Style Sheet Document.css"

It'd be better just to create a new css file without calling any script, but I don't think that's possible. However, if anyone has an any idea, I'd love to hear it.

Look at it. It's beautiful :)

enter image description here


Answer taken from here

To Add an Item in “New” menu:

  • Type regedit in RUN dialog box and press Enter. Now expand “HKEY_CLASSES_ROOT” key.
  • Now look for the file type which you want to add in “New” menu, e.g. for adding MP3 file type look for .MP3 key.
  • Right-click on it and select “New -> Key” and give it name “ShellNew”.
  • In right-side pane, right-click and select “New -> String Value”. Give it name “NullFile” and press Enter.
  • Thats it. You’ll immediately get the file type entry in “New” menu.