How to add new files in the menu to create. Edit the menu for creating files "Explorer" Windows

Customize and adjust to your needs the context menu of "Explorer", in particular, the submenu creating new files and folders.

In the "Explorer" context menu of Windows there is a submenu for creating new files and folders. However, there is not much use for it, since the necessary programs usually do not write their templates there, and unnecessary ones, on the contrary, just take the lines in vain. In this article we will describe how this menu can be adjusted to suit your needs.

Adding shortcuts to menu items

Inside the event handlers, the following code is added. Now all you need to do is add shortcuts to the items you need. As a result, you get this picture. Interesting functionality, which is worth mentioning, is the ability to customize your own text to describe the addition of a shortcut.

The "New Item" menu in the "File Explorer" allows you to create a new element for a particular program in the current open folder. You can add items to this menu for other programs not included in this menu. Some programs automatically add entries to the "New Item" menu, and some do not.

First, let's look at how to clear it of unnecessary lines.

There are two options. The first option is to use the Microsoft PowerToys Tweak UI tool.

After installing and downloading this application, follow the section Templates. It's all simple. Pressing the Delete button deletes the selected line, and by removing the checkmark next to one or another line, we temporarily deactivate the menu item for which it answers.

Step two: add your template file to the registry

The first thing we need to do is create a new file in the program that we want to add to the menu. You can see other files that were automatically added when installing other programs. Now that our new file is in place, we will add the key to the registry, which will use this file to create new files in the program, which we add to the "New Item" menu.

Standard warning: Registry Editor is a powerful tool and misuse, which can make your system unstable or even inoperable. It's a pretty simple hack, and as long as you follow the instructions, you should not have any problems. However, if you have never worked with this before, think about it before you start working. And definitely before making changes.

If someone does not like this simple solution (or operating system  Windows of the old version, with which PowerToys does not work), then there is a second option. Its essence is as follows. Experimentally, we find out what extension the created file has, from the possibility of creating which we want to get rid of. Let's say this.doc. We go to the registry, find the HKEY_CLASSES_ROOT branch and open the file.doc extension.

Now you can create a new file of the type that you added. You should see an option for the program that you added in the drop-down menu. Select a new option to create a new file of this type. You will have to experiment with the programs that you want to add. If you try to add a program to the "New Item" menu, and it does not work, it will not damage your system.

This can be a hassle, so why do not you add the "Open with Notepad" option right in your shortcut menu? We showed that you quickly open applications. But if you ever wanted to open a file for quick viewing in Notepad, you can save on the fact that you need to wade through the "Open With" window by adding the "Open with Notepad" option to the default context menu for all files .

Remove all subdirectories named ShellNew from the branch. Note that they can be either directly in the extension folder or in its deeper subdirectories. It is recommended to save a copy of this registry branch.

Well, with the removal understood. All changes take effect immediately (more precisely, after a few seconds), a reboot is not required.

Add "Open with Notepad" to the shortcut menu, editing the registry manually

It will automatically add the "Open with Notepad" option to the context menu and, as a rule, will better cope with the formatting of configuration files and other code. In the Registry Editor, use the left sidebar to move to the next key.

Then you create a new key inside the shell key. Name the new key "Open with Notepad". Now you create another new key inside of it. Changes must occur immediately. This will also delete the command key that you created inside. If you do not want to dive into the registry yourself, we've created a couple of registry hackers that you can use. The "Add with Notepad to the shortcut menu" knob creates the keys needed to add the "Open with Notepad" command. "Remove the open with a notepad from context menu"Hacking removes these keys, removing the command and restoring the default value.

Now let's see how you can create your own line in this menu.

Let's start solving the problem again with the help of Microsoft PowerToys Tweak UI mentioned above. First in the program  create a file and save it (it will be the initial template). Then open the Tweak UI and click the Create button in the Templates section. The utility will ask you to specify a template file, specify only the created file. Done. Now, if you select the line of our new file in the context menu, the template file will be copied to this place.

Running hacks only creates or deletes keys to add commands to the context menu. And if you like to mess around with the registry, it's worth spending time learning. After the command, you can have several placeholders that will be replaced with actual values ​​when the program is started.

Your ready screen should probably look something like the screenshot below. This documentation is archived and not supported. You can define a command so that it is displayed only in the menu in certain circumstances. Use the method in this section if.

Meanwhile, the possibilities of this mechanism are much wider than what the Tweak UI offers. For example, you can automatically run a program at once, or create a template file of zero size.

So, if simple creation  file is small, we go to the registry in the HKEY_CLASSES_ROOT section, we find there an extension of the desired file type. There we grope or create a subfolder named ShellNew (in order to create a new line in the context menu of the explorer about creating the file, just create a subfolder with the name ShellNew in the registry for the extension of the desired file type).

  • You want to define certain groups of commands in the menu.
  • You want to define only one command.
These definitions define the labels for the menu items and where they appear in the menu. Whenever you add or change a command, update the version parameter of the one that applies to the package class before you release new version  your domain.

If you want, you can write the parameter name explicitly to remind you of its purpose. Increase the version parameter of the attribute, which is the second parameter. . To add new commands, you must extend this class by creating a new file that contains a partial declaration of the same class. It's useful to start by checking the name of the class and checking its contents. Pay attention to the namespace and the name of the first class that is defined there. In the new file, write a partial declaration that has the same namespace and name as the generated partial class. Typically, you need to import the following namespaces for your command-set code.

The next option is to give the option to create a file to the program. Specify a string parameter Command. As it is easy to guess from the title, this command line, which will be launched. In Command we simply write in quotation marks the full path to the program file, a space and (also in quotation marks) the macro% 1 (it will be replaced with the name of the file just created), for example, "c: \\ windows \\ notepad.exe" "% 1" .

Determine when the team will be visible

You need to define two methods: one to determine when the command is visible in the context menu, and the other to execute the command. These methods do not override; Instead, you register them in the list of commands. In this example, the command is visible only when the user has selected a particular type of shape and is enabled only when at least one of the selected elements is in a certain state.

If you make changes to the model elements, you must do this within the transaction. This section explains how to associate a keyboard shortcut with a custom button, a menu item, or a toolbar command and how to apply a default keyboard mapping to the editor or limit it to a custom editor. You should not assign the same label to multiple commands, because duplicate bindings are difficult to detect and can also lead to unpredictable results.

Now the created file will open immediately in the specified program.

Parameters FileName, Data, NullFile, Command all together can not be used, you can apply only one of them.

1. Described in the Knowledge Base

Adding a new item to the "Create" menu
  Chebotarev Igor

I was sitting here recently, sculpted several pages for the site. It was necessary to create all the files "from scratch", so that the method of simple copying and editing did not pass. I usually work in FARe, but this time I had to use a computer where it was not, and create all the files in the notebook. It is painfully uncomfortable to do this - to create a bunch of original files of the same type all the time, and I remembered the possibility of creating files windows tools. Did you pay attention to the context menu item "Create", which appears if you click on the Desktop or free space  open folder? Well, of course, they did, because that's how you create new directories and shortcuts to programs. But you created something else (because there is a very impressive list)? I doubt it. And if they created it, it is very rare. And, nevertheless, it is very convenient function. It's a pity that there are not those files that we can use. So what's the problem? Add the menu items for the files we need.
  So, it all started with html-files, and a large part of the audience of this site are people who are somehow related to web design, so I will show you how to create a new menu item.
  But we will not start from the registry (although it can not do without it), but from the Windows directory (well, or where it is installed there) ... We need to find the ShellNew directory there. Please note that it is hidden. It stores the workpieces for files that are created using the context menu. If you have installed Microsoft Office, then you will see in this directory files for Word and Excel, and some other files. But now they do not interest us. Create a file in it, for example index.html. Use for these purposes is best FARom (I really love this file manager, so I'm trying to promote it in the masses). Inside it write the preparation of your page. Personally, I wrote the following:

To check if a shortcut is available

Therefore, it is recommended to check the availability of the shortcut before its assignment. If you need help with this, take a look at it.

Assign keyboard shortcuts to the command

  In the section Virtual Key Codes. This is the name of the custom editor. The command is available only in a custom editor, not in other editors.

This step-by-step guide puts the context menu in the tool window. Commands in the context menu behave the same as commands in other menus or toolbars. In chapter. . The shortcut menu, for example, shown in this walkthrough, allows the user to select from the list of colors that are used to fill the background of the tool window.









although, you can add something else to your taste (for example, meta tags, some kind of design in the body).
  Save the file. Now it's the turn of the registry (as without it :)). If you remember, in the article Registering file extensions with the Windows Registry  the method of this very registration was described. The material presented there will be useful for understanding the essence of the manipulations, although you can do without it. So, look for the HKEY_CLASSES_ROOT \\ .htm and HKEY_CLASSES_ROOT \\ .html section and create ShellNew sections in them. In the ShellNew section, create the string parameter FileName as the value of which we need to specify the name of the template we created. That's all. It remains only to restart the computer and admire the new menu item.
  By the way, the file will be created initially with the name that is specified in the "Default" parameter of the HKEY_CLASSES_ROOT \\ htmlfile section (which section is for other extensions can be seen in the "Default" parameter of the HKEY_CLASSES_ROOT \\ .XXX section, where XXX is the file extension) .
  Actually, I said "all" early. After all, you do not need to create a file template. It can be empty, but then instead of the FileName parameter, you need to create an empty string parameter NullFile.
  And what if the partition with the extension you need is not in HKEY_CLASSES_ROOT? Here, then you will need a reference to the article above. First, you register this extension in Windows, and then you do all the simple manipulations described in this article.
  Well, how to remove the menu item from the "Create", I think, should not be explained. Everything is quite simple and it will not be difficult to understand.
  Now everything is for sure. Finally, I will say that by spending fifteen minutes, you can save much more time in the future, because you can create not only html-files, but also any others. Who prevents to create several templates of frequently used documents of your organization, and then only to choose the necessary ones from the menu. So it all depends on your imagination, and I'm sure that you have it rich :).

In this section, the context menu and its commands are implemented. The following steps show how to make the access to the user control available to the menu command. Then use the menu command to add commands to the context menu. It also allows you to create new documents, folders, shortcuts or items when you select a new shortcut menu.

Change or delete items from the new context menu

Open Registry Editor and navigate to the next key and expand it. Find the new file type that you want to remove from the "New" context menu. To add an item or file type, find the file type. Elements will no longer be displayed in your new context menu.

Do you like the article? Share with friends: