Sometimes users need to delete all files within selected folders in Windows 11. For example, you can free up some drive space by erasing all junk files within the Temp folder. To clear a folder without erasing it, you’ll usually need to press Ctrl + A to select all files and then press Delete.

However, there is a better way to empty a folder. You can create a new File Explorer context menu option for emptying folders instead. This is how you can set up two alternative context menu options for emptying folders in Windows 11.

How to Add an Empty Folder Contents Option to the Context Menu

You can create new context menu options for emptying folders with registry scripts. This first registry script will add a context menu entry that erases all files within a primary folder. However, that option won’t delete subfolders in the same directory. You can set up the registry script for adding that Empty folder option as follows:

  1. Click All apps on Windows 11’s Start menu.
  2. Select Notepad on the apps list.
  3. Next, select this text for the empty folder registry script with your mouse cursor and press Ctrl + C:
            Windows Registry Editor Version 5.00


    [HKEY_CLASSES_ROOT\Directory\Shell\EmptyFolder]

    "Icon"="shell32.dll,-16715"

    "MUIVerb"="Empty folder"

    "Position"="bottom"


    [HKEY_CLASSES_ROOT\Directory\Shell\EmptyFolder\command]

    @="cmd /c title Empty \"%1\" & (cmd /c echo. & echo This will permanently delete all contents in only this folder and not subfolders. & echo. & choice /c:yn /m \"Are you sure?\") & (if errorlevel 2 exit) & (cmd /c \"cd /d %1 && del /f /q *.*\")"
  4. Paste the script’s contents into Notepad by clicking Edit and Paste in that app.
    The registry script for the Empty folder option
  5. Select File at the top of Notepad, then click Save as to bring up that window.
    The Save as menu option
  6. Select the All files option that’s available on the Save as type drop-down menu.
  7. Type Empty Folder.reg inside the File name text box.
    The All files option
  8. Save your Empty Folder registry script to the desktop, then exit Notepad.
  9. Double-click Empty Folder.reg on your desktop.
  10. A dialog box message will pop up that requests confirmation. Select Yes to confirm you are sure.
  11. Select OK to close the second dialog box.

Now you can try out the new Empty folder context menu option. To do so, press the Win + E to view Explorer’s window. Input this folder location in File Explorer’s path bar and press Enter:

        C:\Users\user folder name\AppData\Local\
    

You’ll need to replace user folder name in that path with your actual user folder’s title.

There you’ll find the Temp folder, from which you can now erase all temporary junk files on Windows with your new context menu option. Right-click the Temp folder and select Show more options. Select the new Empty folder context menu option.

The Empty folder option

A message will then appear requesting confirmation. Press the Y button to confirm and erase all junk files that aren’t in use within the Temp folder. The Empty folder option permanently deletes all files. So, you won’t be able to restore them from the Recycle Bin.

The confirmation message for emptying the folder

If you later decide you don’t want to keep the Empty folder option, you can remove it from the context menu. To do that, you’ll need to delete the Empty folder option's registry key like this:

  1. Press the Win keyboard key to open the Start menu.
  2. Click All apps and scroll down to the Windows Tools folder.
  3. Open Windows Tools (see how to open Windows Tools) to view that folder’s contents.
  4. Then double-click Registry Editor to bring up Windows 11’s Regedit app.
  5. Open this key by inputting its path in Registry Editor’s address bar:
            HKEY_CLASSES_ROOT\Directory\Shell\EmptyFolder
        
  6. Right-click the EmptyFolder key and select Delete.
    The EmptyFolder key's Delete option
  7. Select Yes on the Confirm Key Delete prompt.

How to Add an "Empty Folder and Delete Subfolders" Option to the Context Menu

The Empty folder option added with the registry script above doesn’t erase subfolders in directories. So, we’ll set up an additional context menu option that also deletes subfolders in a folder. Then you can use that option to fully empty a folder when needed.

You can set up a registry script for adding an Empty folder and delete subfolders context menu option with Notepad much the same as specified above. However, you’ll need to copy a different script for step three. Copy and paste (see how to copy and paste on Windows 11) the following script into Notepad:

        Windows Registry Editor Version 5.00



[HKEY_CLASSES_ROOT\Directory\Shell\EmptyFolder2]

"Icon"="shell32.dll,-16715"

"MUIVerb"="Empty folder and delete subfolders"

"Position"="bottom"



[HKEY_CLASSES_ROOT\Directory\Shell\EmptyFolder2\command]

@="cmd /c title Empty \"%1\" & (cmd /c echo. & echo This will instantly permanently delete everything in this folder. & echo. & choice /c:yn /m \"Are you sure?\") & (if errorlevel 2 exit) & (cmd /c rd /s /q \"%1\" & md \"%1\")"

Follow all the other steps after that as outlined above. Input an Empty Folder and Delete Subdirectories.reg file name for the registry script, and save it to the desktop. Then double-click that registry script on the desktop to add an Empty folder and delete subdirectories context menu option.

The registry script for the Empty folder and delete subfolders option

Select a folder in Explorer, and press the Shift + F10 hotkey. Now you’ll see an Empty folder and delete subdirectories option on the classic context menu. Select that option whenever you need to completely clear out a folder.

The Empty folder and delete subfolders context menu option

You can remove that context menu option much the same as the Empty folder one. Open that option’s key location in the Registry Editor and delete it from there. This is the Empty folder and delete subdirectories option’s registry key location:

        HKEY_CLASSES_ROOT\Directory\Shell\EmptyFolder2
    

You can also change the wording of the Empty folder and delete subdirectories context menu option from that registry location. To do so, double-click the MUIVerb string for the EmptyFolder2 key. Erase Empty folder and delete subdirectories in the Value box; then input an alternative title for the option there and click OK to change it. That context menu option will have whatever title you enter for it there.

The MUIVerb string or the EmptyFolder2 key

Empty Your Folders With Convenient Context Menu Options

An Empty folder option is something File Explorer should already include. Now you can easily clear out your folders in Windows 11 with two convenient Explorer context menu options. Those new options will come in handy for clearing cache folders or other directories full of unneeded user files.