Delete contents folder context with check
Posted: 10 Apr 2016 07:44
I'm trying to add a conext menu that will detele the selected folder's contents but I want to check if the current path is set to the selected folder first.
I've written the following but It doesn't work. It does change to the folder but doesn't delete anything.
If I execute like this, the %cd% is replaced with cmd path, which I do not want.
I tried running it like this and still does not work:
Any insight? Thank you
I've written the following but It doesn't work. It does change to the folder but doesn't delete anything.
Code: Select all
REG ADD "HKEY_CLASSES_ROOT\Directory\shell\Empty Directory\Command" /ve /d "cmd /c \"pushd %1 ^& if \"%cd%\"==%1 (del /s /f /q *.*)\"" /f
If I execute like this, the %cd% is replaced with cmd path, which I do not want.
I tried running it like this and still does not work:
Code: Select all
REG ADD "HKEY_CLASSES_ROOT\Directory\shell\Empty Directory\Command" /ve /d "cmd /c \"setlocal enabledelayedexpansion ^& pushd %1 ^& if \"!cd!\"==%1 (del /s /f /q *.*)\"" /f
Any insight? Thank you