Advertisement

Add Empty Folder Context Menu in Windows 10

Today, we will see how to add a special context menu entry, "Empty this folder". It will permanently and instantly delete the folder contents. This can be useful if you are using a folder to store temporary files for your project. The context menu command will be added for all users of the operating system installed on your computer.

Advertisеment

It is not so hard to delete all files and folders from a specific directory on your hard drive. You can click on the command "Select all" in the Ribbon, and then click on Delete. Alternatively, you can press Ctrl + A to select everything in the folder and then press the Shift + Del keys.

The "Empty this folder" context menu entry saves your time. It deletes the folder contents with a single click. To avoid accidental emptying of folders, it shows a confirmation.

You need to sign in as Administrator before proceeding.

Windows 10 Empty This Folder Menu 1Windows 10 Empty This Folder Menu 2Windows 10 Empty This Folder Menu 3

To add the Empty Folder context menu in Windows 10, do the following.

  1. Download the following Registry files in the zip archive: Download Registry Files.
  2. Extract them to any folder you like. You can place them right on the Desktop.
  3. Unblock the *.REG files.
  4. Double click the "Add Empty folder context menu.reg" file.

The undo tweak is included. It is called 'Remove Empty folder context menu.reg'. Just double-click on it to remove the entry.

How it works

This tweak is very simple. The context menu entry calls the following console commands, one by one.

  • cmd.exe /c - to open a new command prompt window.
  • choice - to show a confirmation. The command looks as follows: choice /c:yn /m "Are you sure you want to delete everything in the folder '%1'?"
  • errorlevel - to analyze your input. Here is the command: if errorlevel 2 exit. If you type N in the console, the command sequence will be aborted. Errorlevel = 2 means the second option in 'choice'.
  • Finally, the last command does the trick. It removes the target directory and its contents, then re-creates a new empty folder with the same name. cmd /c rd /s /q "%1" & md "%1".

That's it.

Support us

Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:

If you like this article, please share it using the buttons below. It won't take a lot from you, but it will help us grow. Thanks for your support!

Advertisеment

Author: Sergey Tkachenko

Sergey Tkachenko is a software developer who started Winaero back in 2011. On this blog, Sergey is writing about everything connected to Microsoft, Windows and popular software. Follow him on Telegram, Twitter, and YouTube.

Leave a Reply

Your email address will not be published.

css.php
Using Telegram? Subscribe to the blog channel!
Hello. Add your message here.