I was having an issue editing the hosts file on Windows. I was receiving an error saying that only the Administrator could edit the file since the etc directory was protected. My user has Administrator access so I couldn’t understand what was going on. I tried to change the settings on the etc directory and could not do that either.
So I ended up opening Wordpad (which I use to edit the hosts file), by right-clicking and selecting Run as Administrator. Once I did that and opened my hosts file in Wordpad, I was able to save the file.