Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.

Windows 7: Security issues (Access Denied)

30 Nov 2012   #21

Windows 7 Ultimate x64

I right-clicked on the file, selected properties and then the security tab, clicked "edit" and answered the UAC prompt, added myself explicitly to the security info, set "full control" and I can now edit the file with Notepad++

The temptation is to leave it like that, but I'll remove my access now I've achieved what I want.

I may create a little batch jpb to do this with CACLS.

Ah. It appears that CACLS is "deprecated", I should use ICACLS now.


I have two little batch files (you'd need to change this to use your favourite editor)


icacls c:\windows\system32\drivers\etc\hosts /grant %username%:(F)
"C:\Program Files (x86)\Notepad++\notepad++.exe" c:\windows\system32\drivers\etc\hosts
icacls c:\windows\system32\drivers\etc\hosts /remove %username%
You need to run this in a DOS session running elevated - I have a shortcut pinned to my start menu that starts the command shell, with "run as administrator" set. I've also changed the colours so it's obvious that it's the "all-powerful" version.

If there's a way to stall the CMD processing while the editor is active, this could all be done in a single batch file, removing the possibility of forgetting the save.

My System SpecsSystem Spec


 Security issues (Access Denied)

Thread Tools

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd

All times are GMT -5. The time now is 10:00 AM.
Twitter Facebook Google+

Windows 7 Forums

Seven Forums Android App Seven Forums IOS App

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 32 33