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:
Click All apps on Windows 11’s Start menu. Select Notepad on the apps list. 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 *. *")” Paste the script’s contents into Notepad by clicking Edit and Paste in that app. Select File at the top of Notepad, then click Save as to bring up that window. Select the All files option that’s available on the Save as type drop-down menu. Type Empty Folder. reg inside the File name text box. Save your Empty Folder registry script to the desktop, then exit Notepad. Double-click Empty Folder. reg on your desktop. A dialog box message will pop up that requests confirmation. Select Yes to confirm you are sure. 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:
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.
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.
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:
Press the Win keyboard key to open the Start menu. Click All apps and scroll down to the Windows Tools folder. Open Windows Tools (see how to open Windows Tools) to view that folder’s contents. Then double-click Registry Editor to bring up Windows 11’s Regedit app. Open this key by inputting its path in Registry Editor’s address bar: HKEY_CLASSES_ROOT\Directory\Shell\EmptyFolder Right-click the EmptyFolder key and select Delete. 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:
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.
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.
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:
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.
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.