更新时间:2023-12-06 08:52:22
感谢乔伊(Joey)评论,我得以找到以下内容:解决方案。
Thanks to Joey comment I was able to find the following solution.
步骤1:创建扩展名为 reg
的文件(例如 add_delete_empty_folders_to_context_menu .reg
)并在其中添加以下行:
Step 1: create a file with reg
extension (like for example add_delete_empty_folders_to_context_menu.reg
) and put the following lines inside it:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\shell\Delete empty folders]
[HKEY_CLASSES_ROOT\Directory\shell\Delete empty folders\Command]
@="cmd /c for /f \"usebackq delims=\" %%d in (`\"dir \"%1\" /ad/b/s | sort /R\"`) do rd \"%%d\""
步骤2:双击 reg
文件并给出所有需要的确认。
Step 2: double click on your reg
file and give all the needed confirmations.
现在您有了一个方便的删除空文件夹上下文菜单中的code>命令,右键单击目录会弹出。在Windows 7和Windows 10上我可以使用。
Now you have a handy Delete empty folders
command in your context menu, popping up when you right-click on a directory. This works for me on Windows 7 and Windows 10.
为避免滥用此功能,某些软件需要使用空文件夹才能正常工作。
Avoid abuse of this functionality, some softwares need their empty folders to work properly.
跟进
如果遇到麻烦(如Enora,请参见下文),则可以尝试使用以下行在 reg
文件中,代替原始文件:
If you experience trouble (as Enora, see below) you can try to use the following line in the reg
file, in place of the original one:
@="cmd.exe /K for /f \"usebackq delims=\" %%d in (`\"dir \"%V\" /ad/b/s | sort /R\"`) do rd \"%%~d\""
我实际上不知道如果此版本更强大,我只需在此处报告Enora为她的案例找到的解决方案。
I actually don't know if this version is more robust, I just report here the solution found by Enora for her case.