How to Edit Files That Require Admin Privileges
There are certain files and folders in Windows that you can only access when you are logged in as the administrator of that computer.
For instance, if you ever need to block a website on your home computer through the hosts file, your would require administrative privileges. Similarly, you may not be able to execute all the commands at the command prompt if you not logged in as the admin.
Sometimes Administrators Cannot Edit Files
There’s another related problem that mostly concerns the home consumers of Windows 7 and Vista.
Sometimes you are the admin (and the only user) of your home computer and yet, when you try to open some protected file, it says “access denied”. This is confusing because you are logged in as the super-user and if you don’t have access to all parts of the system, who else will?
The fix is simple though. I will illustrate this with Windows hosts file but you can apply the workaround to virtually all files that you are unable to read / edit in Windows because of permission problems.
Step 1. Open your Windows start menu, search for the notepad application and then right click the notepad icon.
Step 2. Choose “Run as administrator” and then, while inside notepad, browse to folder (/windows/system32/drivers/etc) that contains the hosts file.
You can now edit and save that file in the same folder without any issues. To recap, the trick is that instead of directly opening a protected file in the associated application, you run the application first as an administrator and then open the file inside it.
Google Developer Expert, Google Cloud Champion
Amit Agarwal is a Google Developer Expert in Google Workspace and Google Apps Script. He holds an engineering degree in Computer Science (I.I.T.) and is the first professional blogger in India.
Amit has developed several popular Google add-ons including Mail Merge for Gmail and Document Studio. Read more on Lifehacker and YourStory