6

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.

2

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

0

I created the attached reg file "template" that helps create a menu with two submenus in Windows 10. I hope you find this useful. Delete all the comments in the reg file after you complete your submenu.

;--------------------------------------------------

Windows Registry Editor Version 5.00

;add.submenu.to.context.menu.blank.template
;(1) Change "MUIVerb"="MyNewMenu" to top level TITLE of both 
;Directory and Background menus (BOTH should have same TITLE)
;(2)Change all MyMenu1 to a unique identifier for this entire one submenu
;(3)Change "MUIVerb"="FirstCommand" to first command name
;(4)Change command line (@) following MUIVerb FirstCommand to desired first
command line
;(5)Change "MUIVerb"="SecondCommand" to second command name
;(7)Change command line (@) following MUIVerb SecondCommand to desired second
command line
;(8)Change icons if desired
;(9)Save file as .reg file

;This displays context menu when you right-click Directory
[HKEY_CLASSES_ROOT\Directory\shell\MyMenu1]
;Directory Level Menu Title 
"MUIVerb"="MyNewMenu"
"Icon"="cmd.exe"
"ExtendedSubCommandsKey"="Directory\\ContextMenus\\MyMenu1"

;This displays context menu when you right-click Directory Background
[HKEY_CLASSES_ROOT\Directory\background\shell\MyMenu1]
;Background Level Menu Title
"MUIVerb"="MyNewMenu"
"Icon"="cmd.exe"
"ExtendedSubCommandsKey"="Directory\\ContextMenus\\MyMenu1"

;First command under submenu
[HKEY_CLASSES_ROOT\Directory\ContextMenus\MyMenu1\shell\open]
"MUIVerb"="FirstCommand"
"Icon"="cmd.exe"

[HKEY_CLASSES_ROOT\Directory\ContextMenus\MyMenu1\shell\open\command]
@="cmd.exe /s /k pushd \"%V\""

;Second command under submenu
[HKEY_CLASSES_ROOT\Directory\ContextMenus\MyMenu1\shell\runas]
"MUIVerb"="SecondCommand"
"Icon"="cmd.exe"
"HasLUAShield"=""

[HKEY_CLASSES_ROOT\Directory\ContextMenus\MyMenu1\shell\runas\command]
@="cmd.exe /s /k pushd \"%V\""
;-------------------------------------------------

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.