Skip to content

Instantly share code, notes, and snippets.

@banasiak
Last active October 10, 2019 09:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save banasiak/0c6b7b038591e0d77537 to your computer and use it in GitHub Desktop.
Save banasiak/0c6b7b038591e0d77537 to your computer and use it in GitHub Desktop.
@echo off
echo Create Backup copies of the original notepad.exe
copy C:\Windows\notepad.exe C:\Windows\notepad.exe.bak
copy C:\Windows\System32\notepad.exe C:\Windows\System32\notepad.exe.bak
copy C:\Windows\SysWOW64\notepad.exe C:\Windows\SysWOW64\notepad.exe.bak
echo Take Ownership of the files
takeown /F C:\Windows\notepad.exe /A
takeown /F C:\Windows\System32\notepad.exe /A
takeown /F C:\Windows\SysWOW64\notepad.exe /A
takeown /F C:\Windows\winsxs\amd64_microsoft-windows-notepadwin_31bf3856ad364e35_10.0.10240.16384_none_4aca3e8d95ba586d\notepad.exe /A
takeown /F C:\Windows\winsxs\amd64_microsoft-windows-notepad_31bf3856ad364e35_10.0.10240.16384_none_771aff2a0aad0617\notepad.exe /A
takeown /F C:\Windows\winsxs\wow64_microsoft-windows-notepad_31bf3856ad364e35_10.0.10240.16384_none_816fa97c3f0dc812\notepad.exe /A
echo Assign full rights to the administrators group
icacls c:\windows\notepad.exe /grant Administrators:F
icacls C:\Windows\System32\notepad.exe /grant Administrators:F
icacls C:\Windows\SysWOW64\notepad.exe /grant Administrators:F
icacls C:\Windows\winsxs\amd64_microsoft-windows-notepadwin_31bf3856ad364e35_10.0.10240.16384_none_4aca3e8d95ba586d\notepad.exe /grant Administrators:F
icacls C:\Windows\winsxs\amd64_microsoft-windows-notepad_31bf3856ad364e35_10.0.10240.16384_none_771aff2a0aad0617\notepad.exe /grant Administrators:F
icacls C:\Windows\winsxs\wow64_microsoft-windows-notepad_31bf3856ad364e35_10.0.10240.16384_none_816fa97c3f0dc812\notepad.exe /grant Administrators:F
echo Copy new notepad.exe over the original versions
copy /y notepad.exe C:\Windows\notepad.exe
copy /y notepad.exe C:\Windows\System32\notepad.exe
copy /y notepad.exe C:\Windows\SysWOW64\notepad.exe
copy /y notepad.exe C:\Windows\winsxs\amd64_microsoft-windows-notepadwin_31bf3856ad364e35_10.0.10240.16384_none_4aca3e8d95ba586d\notepad.exe
copy /y notepad.exe C:\Windows\winsxs\amd64_microsoft-windows-notepad_31bf3856ad364e35_10.0.10240.16384_none_771aff2a0aad0617\notepad.exe
copy /y notepad.exe C:\Windows\winsxs\wow64_microsoft-windows-notepad_31bf3856ad364e35_10.0.10240.16384_none_816fa97c3f0dc812\notepad.exe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment