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.

File Permission Error

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.

Amit Agarwal

Amit Agarwal

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

Awards & Titles

Digital Inspiration has won several awards since it's launch in 2004.

Google Developer Expert

Google Developer Expert

Google awarded us the Google Developer Expert award recogizing our work in Google Workspace.

ProductHunt Golden Kitty

ProductHunt Golden Kitty

Our Gmail tool won the Lifehack of the Year award at ProductHunt Golden Kitty Awards in 2017.

Microsoft MVP Alumni

Microsoft MVP Alumni

Microsoft awarded us the Most Valuable Professional (MVP) title for 5 years in a row.

Google Cloud Champion

Google Cloud Champion

Google awarded us the Champion Innovator title recognizing our technical skill and expertise.

Email Newsletter

Sign up for our email newsletter to stay up to date.

We will never send any spam emails. Promise.