After setting the ban, the object can neither be opened, nor deleted, nor copied, nor renamed. The ban is set for the "Everyone" group.
Deny access
icacls "C:\my_file.txt" /deny *S-1-1-0:F
Open access
icacls "C:\my_file.txt" /grant *S-1-1-0:F
Add blocking setting to file and 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 26 27 28 29 30 31 |
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\Directory\Shell\DenyAccess] "MUIVerb"="Deny access" "HasLUAShield"="" "Extended"="" "SubCommands"="denyAccess_on;denyAccess_off" [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\denyAccess_on] @="Deny access" "Icon"="regedit.exe" "NoWorkingDirectory"="" [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\denyAccess_on\command] "IsolatedCommand"="cmd.exe /c icacls \"%1\" /deny *S-1-1-0:F" @="cmd.exe /c icacls \"%1\" /deny *S-1-1-0:F" [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\denyAccess_off] @="Allow access" "Icon"="regedit.exe" "NoWorkingDirectory"="" [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\denyAccess_off\command] "IsolatedCommand"="cmd.exe /c icacls \"%1\" /grant *S-1-1-0:F" @="cmd.exe /c icacls \"%1\" /grant *S-1-1-0:F" [HKEY_CLASSES_ROOT\*\Shell\DenyAccess] "MUIVerb"="Deny access" "HasLUAShield"="" "Extended"="" "SubCommands"="denyAccess_on;denyAccess_off" |
Remove from context menu
1 2 3 4 5 6 |
Windows Registry Editor Version 5.00 [-HKEY_CLASSES_ROOT\Directory\Shell\DenyAccess] [-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\denyAccess_on] [-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\denyAccess_off] [-HKEY_CLASSES_ROOT\*\Shell\DenyAccess] |
The context menu should be called while holding Shift
If you need without using Shift, delete the lines:"Extended"=""