ChickPea57
New member
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.
Right:
I have two little batch files (you'd need to change this to use your favourite editor)
c:\utils\edithost.bat
c:\utils\savehost.bat
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.
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.
Right:
I have two little batch files (you'd need to change this to use your favourite editor)
c:\utils\edithost.bat
Code:
icacls c:\windows\system32\drivers\etc\hosts /grant %username%:(F)
"C:\Program Files (x86)\Notepad++\notepad++.exe" c:\windows\system32\drivers\etc\hosts
c:\utils\savehost.bat
Code:
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 Computer
- OS
- Windows 7 Ultimate x64