Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to edit my hosts file in Windows 8 Pro. When I open C:\Windows\System32\Drivers\etc\hosts in notepad++ or any other text editor, make changes and attempt to save, I get a dialog that tells me "Save failed: Please check if this file is opened in another program."

I can't think of what would be using it (other than a browser, iis, and windows defender). I've never encountered this problem in Windows 7. I have used Process Explorer to try and identify any processes that are currently using the Hosts file but when I search Process Explorer for the "Handle or DLL substring" 'hosts' it doesn't return anything. I've looked around Process Explorer to see if there is any other way to search for processes consuming the file, but haven't had any luck.

I've also tried simply stopping the Windows Defender service and stopping the WWW Service.

Any suggestions would be greatly appreciated!

share|improve this question
Process Explorer itself has been known to sometimes keep a file open. Also make sure you run notepad As Administrator. I've had no issues editing hosts file in win8. –  Bret Fisher Sep 18 '12 at 16:17
Windows 7 != Windows 8. Don't assume that something that works in 7 will work in 8, or that it will work the same way. –  joeqwerty Sep 18 '12 at 16:19
Running as Administrator was the answer, Thanks Bret. –  David Sulpy Sep 18 '12 at 16:27
@joeqwerty - You couldn't be more wrong. –  Ramhound Sep 18 '12 at 19:16
Wrong to not make the assumption that Windows 8 works like Windows 7? My comment wasn't regarding the actual task of editing the hosts file but in the statement that "I never had this problem in operating system X". Any time you assume that tasks/operations you performed in a previous version of the OS will work the same in the next version of the OS is about the time you start going off in the wrong direction. –  joeqwerty Sep 18 '12 at 19:45
add comment

migrated from serverfault.com Sep 18 '12 at 16:34

This question came from our site for professional system and network administrators.

7 Answers

up vote 20 down vote accepted

You have to run Notepad++ as administrator. Otherwise you won't have the neccessary permissions to edit that file.

share|improve this answer
Is there any way to make it so you don't have to run as admin to edit that file? –  Saturn2888 Sep 18 '12 at 17:48
Not that i'm aware of. –  Frederik Nielsen Sep 18 '12 at 18:31
@Saturn2888 I would highly advise that you not change the permissions. Otherwise, A virus could hijack all of your webbrowsing by injecting DNS entries into it for the websites you go to, and redirect you to malicious websites. –  Darth Android Sep 18 '12 at 18:51
If you're frustrated with the whole Run as Admin thing here's how you can use the Shell Extension shortcut to do this: 1) Right click hosts file -> Open in Notepad++ 2) Close Notepad++ 3) Run Notepad++ as administrator. The file should be still open as N++ remembers the last file(s) you had open. Saves you digging through the file-open dialog. –  Aren B Sep 18 '12 at 19:48
@Aren B Sadly, Notepad++ run as admin completely forgets all tabs I had open as a user. It's really annoying. –  Saturn2888 Sep 22 '12 at 1:52
show 1 more comment

If you actually have administrator rights, then you're probably fighting against UAC. Make sure to launch your favorite text editor by right-clicking on it and selecting "Run as administrator".

share|improve this answer
Great point. I am running as a user with administrative rights. –  David Sulpy Sep 18 '12 at 16:40
add comment

You may also want to check your permissions on the host file itself. You may run as administrator but you may not have the rights to edit the file.

share|improve this answer
add comment

I had the same case, and couldn't change the hosts file even after I checked if I had all the permissions in the user settings or the hosts file's permissions.

ANSWER: Some antivirus software (in my case AVIRA)blocks everything in changing hosts files in their security options. Disable it for a minute, and change. Be careful, it can be risky!

share|improve this answer
AVIRA was the problem in my case thx for the hint! –  IvanL Feb 7 at 16:10
add comment

Running as admin didn't work in Windows 8 for me. Here's what I did to solve the problem:

  • Disconnect from net by unplugging network cable (or disable wireless)
  • Find hosts file. right click --> properties --> security
  • Click Users then edit
  • Add write for users (admin has write but didn't work)
  • Edit file by running notepad as admin
  • Save file
  • Remove write for users
  • Reconnect to net.
share|improve this answer
it would be nice if the person who marked this as un helpful left a little note saying why it was unhelpful. this worked for me when the above advice was not working. thanks to peter for the tip. –  nero Jun 27 '13 at 9:46
Probably because it appeared to be more of a comment than an answer. I've edited your answer to be a little more readable, and recognizable as an answer. –  KronoS Jun 27 '13 at 14:18
add comment

Copy the hosts file to another location on the PC (like Documents) and edit in that location. copy hosts file back to original location. Worked for me.

share|improve this answer
this achieves the same result as @BenFisher 's comment... IF a permission dialog pops up during the file replace and IF the file is not in use. –  Lorenzo Von Matterhorn Sep 19 '13 at 22:54
add comment
  1. Right click on notepad.exe
  2. Run as admin
  3. Find the host file and open C:/windows/system32/drivers/etc/host
  4. List item
  5. Edit
  6. Save
  7. Use it
share|improve this answer
This is the same as the accepted answer –  Chenmunka Oct 27 '13 at 11:30
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.