Create a new "New" submenu in context menu with a custom name
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
.
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 :)