Email
Share

We Rock Your Web Forum » Operating Systems » Windows

Windows Vista - edit hosts file?

(5 posts)
  1. Networx

    member
    Joined: Oct '09
    Posts: 11

    I'm trying to block some spammy (spyware) websites using my hosts file. I heard there's a way to redirect malicious sites to 127.0.0.1, thereby preventing your browser from visiting them.

    However, I can't seem to get into my darn hosts file? It keeps telling me access is denied. That is, I can view it, and edit it, but I can't save my changes.

    Posted 2 years ago #

  2. Posted 2 years ago
  3. cwd

    senior admin
    Joined: Jul '09
    Posts: 225

    Basically you'll need to edit the file as administrator. The easiest way to do this is to launch notepad as an administrator. In the Start menu -> search box type "notepad"

    Then right-click notepad.exe and select "run as administrator." You should now be able to save changes to the Windows hosts file.

    You can also create a shortcut to the Windows hosts file that will edit it as an administrator automatically (ie. associate the administrator permission with it) as follows:

    Create a shortcut (on your desktop) to: C:\Windows\System32\notepad.exe C:\Windows\System32\drivers\etc\hosts

    Then, right-click the shortcut, select "properties" -> shortcut tab -> "advanced" button -> check "run as administrator"

    Posted 2 years ago #
  4. Networx

    member
    Joined: Oct '09
    Posts: 11

    Thanks CWD. I tried that and I keep getting the error "Cannot create C:\Windows\System32\drivers\etc\hosts file. Make sure the path and file name are correct."

    Any way around this?

    Posted 2 years ago #
  5. cwd

    senior admin
    Joined: Jul '09
    Posts: 225

    You might need to temporarily disable antivirus software (Norton) while you edit the file. Make sure you turn it back on once you're done.

    If that doesn't work, try copying the hosts file to your desktop, editing it as administrator, and then copying it back to the directory it originated from.

    Finally, make sure the hosts file doesn't have a "read only" flag set. You might need to temporarily add permissions to edit it.

    Posted 2 years ago #
  6. Networx

    member
    Joined: Oct '09
    Posts: 11

    Tried both those suggestions and still get the "path and file name incorrect" error. Then it asks me to save it as a .txt file.

    Okay - I was finally able to get it to work - by adding ".bak" to my existing hosts file, copying the new hosts.txt into the hosts file directory, and then removing the ".txt" extension.

    Posted 2 years ago #

RSS feed for this topic

Reply

(required)

Allowed markup: BBcode blockquote code em strong ul ol li font strike center u hr.
You can also put code in between backtick ( ` ) characters.