0

I work with Angular and it generates project folders that are huge and takes forever to delete with the regular method of folder deletion, but if delete it with the following command in the command line, the folder is gone in a few seconds: rmdir /s /q <folder path>

So, I searched the internet for a solution and found several that tell me to modify the registry. I did, but when I right click on a folder and choose to delete it with the custom menu option ("Folder quick delete"), it does not delete it. Also, If I right click on a blank white space in a folder that has files and child folders and choose "Folder quick delete", it deletes all child folders and some files not in child folders (i.e. in the current root folder). Oddly, if just right click on an empty space in the desktop and choose "Folder quick delete", it not only deletes all folders on the desktop but also some of the shortcuts along with it.

What is wrong with my .reg file?

reg file to add context menu items

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\Delete_Folder]
@="Folder quick delete"
"Extended"=-

[HKEY_CLASSES_ROOT\Directory\shell\Delete_Folder\command]
@="C:\\windows\\system32\\cmd.exe /c rmdir /s /q %V"

[HKEY_CLASSES_ROOT\Directory\Background\shell\Delete_Folder]
@="Folder quick delete"
"Extended"=-

[HKEY_CLASSES_ROOT\Directory\Background\shell\Delete_Folder\command]
@="C:\\windows\\system32\\cmd.exe /c rmdir /s /q %V"

[HKEY_CLASSES_ROOT\Drive\shell\Delete_Folder]
@="Folder quick delete"
"Extended"=-

[HKEY_CLASSES_ROOT\Drive\shell\Delete_Folder\command]
@="C:\\windows\\system32\\cmd.exe /c rmdir /s /q %V"

[HKEY_CLASSES_ROOT\LibraryFolder\background\shell\Delete_Folder]
@="Folder quick delete"
"Extended"=-

[HKEY_CLASSES_ROOT\LibraryFolder\background\shell\Delete_Folder\command]
@="C:\\windows\\system32\\cmd.exe /c rmdir /s /q %V"
1

First, you need to have quotes around the path of the directory argument for a folder with spaces in the filename. To add them, escape the quote charactersas shown below in the shell command for pestudio:

[HKEY_CLASSES_ROOT*\shell\pestudio\command]

@="\"C:\program files\pestudio\pestudio.exe\" \"%1\""

Second, the standard placeholder for the argument is %1, requiring at least one argument. The placeholder %v is used to supply a default argument, the working directory, when none is supplied — somewhat dangerous. That might explain unintended deletion of files and folders. It would be better to use %1 so that the context menu applies to the folder on which you click.

N.B. Be exceedingly careful with backslashes in Registry — one too many or too few can corrupt the Registry (learned from sad experience).

| improve this answer | |
  • I tried your solution, but it did not delete a right clicked folder. I also tried many other different combinations like @="cmd /c \"rmdir /s /q %1\"". Still not working. It just quickly opens and closes the cmd window, but the folder is not deleted. Any ideas how I can make it work? Thanks. – Raj Narayanan Jul 24 '19 at 2:24
0

I found the solution. What worked for me is the following:

@="PowerShell -Command \"Remove-Item -LiteralPath '%1' -Force -Recurse\""
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.