Prevent all users from deleting the folder and its contents
icacls "C:\my_folder" /deny *S-1-1-0:(DE,DC) /t /c
Cancel the ban
icacls "C:\my_folder" /grant *S-1-1-0:(DE,DC) /t /c
Instead of the SID of the "Everyone" user group (S-1-1-0), you can use the name of any group or user (icacls "C:\my_folder" /deny Все:(DE,DC) /t /c)
/deny - deny
/grant - allow
DE - delete
DC - & nbsp; deleting subfolders
/t - perform the operation on all files in all subdirectories
/c - do not interrupt the operation if errors occur
Additional prohibitions (add in parentheses separated by commas)
WD - you cannot modify existing files and add new ones to existing folders, you can add new folders with files
AD - you cannot modify existing files, you can add new ones, you cannot create folders
Newly created folders and files are not bans
Add to folder context menu
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\Directory\Shell\DelDirProtect] "MUIVerb"="Protect from deletion" "HasLUAShield"="" "Extended"="" "SubCommands"="dirdelprotect_on;dirdelprotect_off" [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\dirdelprotect_on] @="Disable" "Icon"="regedit.exe" "NoWorkingDirectory"="" [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\dirdelprotect_on\command] "IsolatedCommand"="cmd.exe /c icacls \"%1\" /deny *S-1-1-0:(DE,DC) /t /c" @="cmd.exe /c icacls \"%1\" /deny *S-1-1-0:(DE,DC) /t /c" [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\dirdelprotect_off] @="Disable" "Icon"="regedit.exe" "NoWorkingDirectory"="" [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\dirdelprotect_off\command] "IsolatedCommand"="cmd.exe /c icacls \"%1\" /grant *S-1-1-0:(DE,DC) /t /c" @="cmd.exe /c icacls \"%1\" /grant *S-1-1-0:(DE,DC) /t /c" |
Remove from context menu
1 2 3 4 5 |
Windows Registry Editor Version 5.00 [-HKEY_CLASSES_ROOT\Directory\Shell\DelDirProtect] [-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\dirdelprotect_on] [-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\dirdelprotect_off] |
The context menu should be called while holding Shift