Hack Forums
[Shell] Add Reset Permissions to Context Menu in Windows 7, Windows 8, and Windows 10 - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [Shell] Add Reset Permissions to Context Menu in Windows 7, Windows 8, and Windows 10 (/showthread.php?tid=6004308)



Add Reset Permissions to Context Menu in Windows 7, Windows 8, and Windows 10 - Emre_ - Sep 2, 2019

This script will add or remove a Reset Permissions context menu to reset effective permissions of files and folders back to their default inherited permissions in Windows 7, Windows 8, and Windows 10.

Code
:: Add Reset Permissions to Context Menu in Windows 7, Windows 8, and Windows 10
@Echo Off & Cls

net sess>nul 2>&1||(powershell start cmd -ArgumentList """/c %~0""" -verb Runas & exit)

Cls & Mode CON  LINES=11 COLS=65 & Color 0D & Title Created By FreeBooter
Echo.
Echo.
Echo.
Echo.
Echo          Add Reset Permissions to Context Menu (Y/N)?  
Echo.      
Echo.
Echo.


Set /p input= RESPONSE:

If /i  Not %input%==Y (Goto :_Ex) Else (Goto :_Start)

:_Ex
If /i Not %input%==N  (Goto :EOF) Else (Goto :_RegRestore)



:_Start

Reg.exe add "HKCR\*\shell\ResetPermissions" /v "MUIVerb" /t REG_SZ /d "Reset Permissions" /f >Nul
Reg.exe add "HKCR\*\shell\ResetPermissions" /v "HasLUAShield" /t REG_SZ /d "" /f >Nul
Reg.exe add "HKCR\*\shell\ResetPermissions" /v "NoWorkingDirectory" /t REG_SZ /d "" /f >Nul
Reg.exe add "HKCR\*\shell\ResetPermissions" /v "Position" /t REG_SZ /d "middle" /f >Nul
Reg.exe delete "HKCR\*\shell\ResetPermissions" /v "Extended" /f >Nul
Reg.exe add "HKCR\*\shell\ResetPermissions\command" /ve /t REG_SZ /d "powershell -windowstyle hidden -command \"Start-Process cmd -ArgumentList '/c icacls \\\"%%1\\\" /reset' -Verb runAs\"" /f
Reg.exe add "HKCR\Directory\shell\ResetPermissions" /v "MUIVerb" /t REG_SZ /d "Reset Permissions" /f >Nul
Reg.exe add "HKCR\Directory\shell\ResetPermissions" /v "HasLUAShield" /t REG_SZ /d "" /f >Nul
Reg.exe add "HKCR\Directory\shell\ResetPermissions" /v "NoWorkingDirectory" /t REG_SZ /d "" /f >Nul
Reg.exe add "HKCR\Directory\shell\ResetPermissions" /v "Position" /t REG_SZ /d "middle" /f >Nul
Reg.exe delete "HKCR\Directory\shell\ResetPermissions" /v "Extended" /f >Nul
Reg.exe add "HKCR\Directory\shell\ResetPermissions" /v "SubCommands" /t REG_SZ /d "" /f >Nul
Reg.exe add "HKCR\Directory\shell\ResetPermissions\shell\001flyout" /v "MUIVerb" /t REG_SZ /d "Reset permissions of this folder only" /f >Nul
Reg.exe add "HKCR\Directory\shell\ResetPermissions\shell\001flyout" /v "HasLUAShield" /t REG_SZ /d "" /f >Nul
Reg.exe add "HKCR\Directory\shell\ResetPermissions\shell\001flyout\command" /ve /t REG_SZ /d "powershell -windowstyle hidden -command \"Start-Process cmd -ArgumentList '/c icacls \\\"%%1\\\" /reset' -Verb runAs\"" /f >Nul
Reg.exe add "HKCR\Directory\shell\ResetPermissions\shell\002flyout" /v "MUIVerb" /t REG_SZ /d "Reset permissions of this folder, subfolders and files" /f >Nul
Reg.exe add "HKCR\Directory\shell\ResetPermissions\shell\002flyout" /v "HasLUAShield" /t REG_SZ /d "" /f >Nul
Reg.exe add "HKCR\Directory\shell\ResetPermissions\shell\002flyout\command" /ve /t REG_SZ /d "powershell -windowstyle hidden -command \"Start-Process cmd -ArgumentList '/c icacls \\\"%%1\\\" /reset /t /c /l' -Verb runAs\"" /f >Nul




Cls & Mode CON  LINES=11 COLS=65 & Color 0D & Title Created By FreeBooter
Echo.
Echo.
Echo.
Echo.
Echo            Adding Reset Permissions to Context Menu
Echo.
Echo.
Echo.
Ping -n 6 localhost >Nul
Exit


:_RegRestore

Reg.exe delete "HKCR\*\shell\ResetPermissions" /f
Reg.exe delete "HKCR\Directory\shell\ResetPermissions" /f >Nul



Cls & Mode CON  LINES=11 COLS=65 & Color 0D & Title Created By FreeBooter
Echo.
Echo.
Echo.
Echo.
Echo            Removing Reset Permissions from Context Menu
Echo.
Echo.
Echo.
Ping -n 6 localhost >Nul
Exit