Some people might have problem to edit their hosts file on Windows 7. A very common problem is that the error message “access denied” pops up. To solve this little problem, here’s a brief instruction how to take ownership of that file and edit it.
If you are on Windows 8 and receive this error, you should also read this guide
UPDATE: The fastest way to modify the hosts file in Windows 7 if you get the access denied error is this:
1. Open an elevated command prompt as described here: Elevated cmd.exe
2. Enter cd \windows\system32\drivers\etc
3. Enter notepad hosts
Or simply open an elevated notepad instance.
If you are not familiar with the command prompt, you can follow the old slow tips below.
Table Of Contents - Quick Links!
Hosts File: Access Denied Error Messages
You don’t have permission to save in this location. Contact the administrator to obtain permission. Would you like to save in My Documents folder instead?
Access to C:\Windows\System32\drivers\etc\ hosts was denied
Cannot create the C:\Windows\System32\drivers\etc\hosts file.
Make sure that the path and file name are correct.
Windows 7 does not give the average user access to many system files. The hosts file is one of those system files.
What can you do about it? First of all, you should know that the default account is not *the* admin account. Therefore, I’d recommend to activate the administrator account to modify system files.
1. Quick workaround to edit the hosts file
You can also simply create a copy of the hosts file. Right-click – “Copy here” and then modify it. Then delete the real hosts file and rename the copy that we just created to “hosts”.
2. Activate Hidden Admin Account
Goto “Start” and enter “cmd” into the search field. Hold CTRL + Shift and hit Enter to run cmd.exe as an administrator.
Enter the following line:
net user administrator /active:yes
3. Take Ownership of the hosts file
Instead of activating the admin account, you can simply add a little option “take ownership of this file” to the context menu.
Simply download the following zip file that includes two registry files. One to add this option to the contect menu and one to remove it.
Alternatively, you can simply copy and paste the following text into a text file and rename the extension to “.reg” (for registry) and then execute it.
@=”cmd.exe /c takeown /f \”%1\” && icacls \”%1\” /grant administrators:F”
“IsolatedCommand”=”cmd.exe /c takeown /f \”%1\” && icacls \”%1\” /grant administrators:F”
@=”cmd.exe /c takeown /f \”%1\” /r /d y && icacls \”%1\” /grant administrators:F /t”
“IsolatedCommand”=”cmd.exe /c takeown /f \”%1\” /r /d y && icacls \”%1\” /grant administrators:F /t”
Trending On Windows 7 Themes .Net
- Mouse Pointers For Windows
- Best Security Software For Windows 8
- Take Professional Screenshots on Windows 8