Hosts file editing: save problem


  1. Posts : 394
    Home Premium 64 bit
       #1

    Hosts file editing: save problem


    My Hosts file was lost so I downloaded a new one. This I edited to block two sites that had intruded and given trouble. I saved initially to desktop and then tried to paste and save it in to C:\windows\.......\etc , but failed to do so as error as per att, appeared,

    I am a sole user/ administrator, and also have opened run Notepad as administrator to no avail.

    What am I doing wrong?
    Attached Thumbnails Attached Thumbnails Hosts file editing: save problem-error-rehosts.png  
    Last edited by rundwald; 11 Dec 2011 at 16:45. Reason: added attachment
      My Computer


  2. Posts : 6,285
    Windows 10 Pro X64
       #2

    Open an Elevated Command prompt and do the following:

    cd \windows\system32\drivers\etc
    attrib -h -s -r hosts

    Copy the new hosts file to this directory

    attrib +r +h +s hosts

    exit

    That should do it.
      My Computer


  3. Posts : 394
    Home Premium 64 bit
    Thread Starter
       #3

    Thanks! It worked, but I wish I understood the commands.
      My Computer


  4. Posts : 6,285
    Windows 10 Pro X64
       #4

    This one changes the current directory (the one you are in) to \windows\system32\drivers\etc. That's where the hosts file is located.

    cd \windows\system32\drivers\etc

    This one clears the Hidden (h), System (s) and Read Only (r) attributes, making the file visible and changeable.

    attrib -h -s -r hosts

    This one turn on the Hidden (h), System (s) and Read Only (r) attributes again to protect the hosts file from being easily modified.

    attrib +r +h +s hosts
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 23:47.
Find Us