Windows – How to edit system files in Windows Vista/7 from Explorer

uacwindowswrite-protect

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?

Best Answer

While Molly's answer is close, if you set the "Run this program as an administrator" on the actual .exe itself (Usually at C:\Program Files\Notepad++ or C:\Program Files (x86)\Notepad++), it'll cause any double clicking on an associated filetype to request elevation.

enter image description here

Keep in mind that this may cause the default "Edit in Notepad++" menu item to break with an error of " Error creating process: nppcm.dll needs to be in the same directory as the notepad++ executable " (at least it did on my default install), but right-clicking on the file, pointing to "Open With" and selecting Notepad++ from there will work.

Related Question