Modify the registry to add the empty folder command in the right-click menu

  

This article describes the method of modifying the registry to add the empty folder command in the right-click menu. Many times, you may need to empty the contents of the folder, but you want to continue to retain the original structure in the folder. If you open each folder one by one to delete the files, it is really troublesome. In fact, we can add related commands in the right-click menu, and it will be much easier to operate later.

Open the registry editor, navigate to "HKEY_CLASSES_ROOT\\Folder\\shell", right-click and select "New → Item", create a new sub-item named "Empty folder contents", then right click To do this, continue to create a new sub-item named "command", select the "command" item, double-click "(default)" in the right pane, and modify the default data to be "cmd /c "cd /d %1 & ;& del /s /f /q *.*", where "cmd /c" means executing the command specified by the string and then terminating; "del" command is for deleting one or several files, "/s" Is to delete the specified file in all subdirectories, "/f" is to force delete the read-only file, "/q" is the so-called quiet mode, no confirmation is required when deleting. Close the registry editor after confirmation.

Now, when we right-click the folder in the Explorer, an option to “Clear Folder Contents” will pop up in the shortcut menu. After selecting, all the contents in the currently selected folder will be cleared, and at the same time Including the subordinate folder It does not pop up when the confirmation prompt box annoying, it is emphasized that this operation just to delete files, folders and the original directory structure will still be retained.

Copyright © Windows knowledge All Rights Reserved