3
3
In Windows Vista/7, when I open a system file (say, system32/drivers/etc/hosts) with an editor (I am using Notepad++, but I guess it can be anything else) and make some changes to it, I cannot save the file due to the file is protected.
To edit the file, I need to open the editor with 'Run as Administrator', click yes to UAC, and open the system file from the editor.
Is there any way for me to open the file with my default editor by opening it from explorer with "Run as Administrator", click yes to UAC, and be able to edit and save the file?
But then when I open a user file I need to click yes to UAC as well? – gilbertc – 2009-09-29T18:52:57.207
Yes, but then you won't have to remember to launch the program beforehand. – Joshua – 2009-09-29T20:29:10.600
that nppcm.dll error is ugly. but i guess it is notepad++ issue. – gilbertc – 2009-09-29T21:28:45.067
This is terrible... You have Notepad++ running in elevated mode all the time. Talk about bad security design from MS... people are still forced to resort to hacks like this to make simple things work. The proper solution to this problem would have been for the OS to ask for elevation permission when needed - ie, right when Notepad++ needs to write a protected file. Elevating it all the time is precisely the wrong thing to do... but the only solution I guess in Win7 – Zoran – 2009-09-30T07:03:18.360
@Zoran: I agree, in fact I don't run this way myself. If I have to edit a system file, I go to the file in Explorer, shift-right-click on the file and select "Copy as Path". I use that path to open the file in a manually elevated Notepad++. As a developer I understand the reasons for not allowing drag and drop between security boundaries and the purpose of elevation but not every one is willing to work with the operating system. In this case, I would prefer someone to run a program like this elevated all the time rather than turning UAC off completely. The lesser or two evils I suppose. – Joshua – 2009-09-30T13:41:23.593