Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: How to edit the Hosts file in 7

12 Sep 2009   #21
Antman

 

Quote   Quote: Originally Posted by DrWho View Post
...I do have some experience ...
When I tried to edit it by adding another entry, it saved my work to Hosts.txt and not the main Hosts file itself. Hmmmmm!

My solution was to rename the main HOSTS file to HOSTS.bac and then rename the hosts.txt file to HOSTS (NO Extension).
That worked like a treat.
Chuckle.

Your solution, while clever, was unnecessary. Your HOSTS file did not save or rename anything. The text editor that you used had the default text file extension selected. You can Save As... All Files (*.*), Any File (*.*) in some editors, and assign the extension - or no extension - during the save process.

The HostsMan app is suitable enough. All users who introduce themselves to HostsMan are advised - thoroughly examine the contents of HOSTS after any and all updates. HostsMan updates will include many popular sites for blocking - MySpace, FaceBook, HomeStead, et cetera.

I happen to like blocking sites like those for some customers, but they are not, in and of themselves, malicious sites.


My System SpecsSystem Spec
.
13 Sep 2009   #22
Bumpus

 

Quote   Quote: Originally Posted by DrWho View Post
Sorry, I didn't mean to rant or ramble.

Cheers Mates!
The Doctor
It's a good topic to rant on.
A well managed host file can make browsig the interweb a little less of a hassle. (It can screw up a few sites too tho...ymmv.)

I use the host file from here on all my pc's. (mvps.org)

I also add some google analytics references cuz, as terrific as many google products are, they just make me feel uncomfortable...one company with alllll that data.
My System SpecsSystem Spec
13 Sep 2009   #23
DrWho

Windows XP-Pro-SP3, Windows 7
 
 

Well, one neat trick I've found with Hosts Manager, if you find that your hosts file may be blocking some site that you want to go to, you can just click the big green "H" in the Hosts window to turn off the hosts file. The "H" then turns RED while the hosts file is disabled.
Then browse away!
No problemo!

Doc B)
My System SpecsSystem Spec
.

13 Sep 2009   #24
Antman

 

You said you had experience with the HOSTS file.

To anyone learning how to use the HOSTS file:

To disable an entry in the HOSTS file,
delete the line(s) containing the entry
or
insert a # as the first character in the offending line(s).

The Green H/Red H method suggested will leave your computer without the protection and other functions provided by HOSTS.

Please note: many HOSTS files found online are provided solely for the blocking of ad servers. Others provide blocking of malware. Others provide both.

Furthermore, a simple batch file can toggle the name of the HOSTS file - creating an On/Off effect. The same batch file can also rename the link used to call the batch file, providing an instant status report of the HOSTS file status - no additional software required.

The sample provided here does not include the shortcut rename trick.
Is it possible to make Firefox ignore the Hosts file without closing it down? - mozilla.support.firefox | Google Groups
My System SpecsSystem Spec
13 Sep 2009   #25
Antman

 

The batch command referenced below with the shortcut rename included. Please note the path will not work on your PC. Modify as needed.

@echo off
cls
goto toggleRename

:toggleRename
If Not %winbootdir%'==' Set HostsOff=%windir%\NOHOSTS
If %OS%'==Windows_NT' Set HostsOff=%SystemRoot%\system32\drivers\etc\NOHOSTS
If %HostsOff%'==' goto noIdeaOfOS
If Not %winbootdir%'==' Set HostsOn=%windir%\HOSTS
If %OS%'==Windows_NT' Set HostsOn=%SystemRoot%\system32\drivers\etc\HOSTS
If %HostsOn%'==' goto noIdeaOfOS
If Not Exist %HostsOff% goto deActivate
goto Activate
goto end

:deActivate
if not exist %HostsOn% goto noHostsFile
ren %HostsOn% NOHOSTS
ren "D:\XPbin\Antman\Application Data\Microsoft\Internet Explorer\Quick Launch\Toggle Hosts ON.lnk" "Toggle Hosts OFF.lnk"
echo.
echo
echo Ŀ
echo HOSTS FILE BLOCKING IS NOW DE-ACTIVATED X
echo
echo.
echo.
echo. Advertising will be visible; Parasite protection off!
echo Renamed from HOSTS to NOHOSTS
echo.
goto end

:Activate
if not exist %HostsOff% goto noHostsFile
ren %HostsOff% HOSTS
ren "D:\XPbin\Antman\Application Data\Microsoft\Internet Explorer\Quick Launch\Toggle Hosts OFF.lnk" "Toggle Hosts ON.lnk"
echo.
echo
echo Ŀ
echo HOSTS FILE BLOCKING IS NOW ACTIVATED
echo
echo.
echo.
echo. Advertising will be hidden; Parasite protection on!
echo Renamed from NOHOSTS to HOSTS
echo.
goto end

:noIdeaOfOS
echo Sorry Unsupported OS.
goto end

:noHostsFile
cls
echo.
echo
echo Ŀ
echo ERROR NO HOST FILES FOUND ! !
echo
echo.
echo .
echo Couldn't find "HOSTS" or "NOHOSTS" in the folder
echo.
echo please check that the HOSTS file is in this folder
echo thanks..

:end
set HostsOff=
set HostsOn=
pause
exit
My System SpecsSystem Spec
14 Apr 2010   #26
Bare Foot Kid
Microsoft MVP

W 7 64-bit Ultimate
 
 

Seven Forums now has a tutorial on the subject of the Hosts File, it can be view at the link below.

Hosts File : Use in Windows 7 / Vista
My System SpecsSystem Spec
13 Sep 2010   #27
Oaken

Windows 7
 
 

I realise this is an old thread though this info helped me with the same issue;

Where is the Hosts File on Windows x64? | sepago
My System SpecsSystem Spec
13 Sep 2010   #28
Bare Foot Kid
Microsoft MVP

W 7 64-bit Ultimate
 
 

Quote   Quote: Originally Posted by Bare Foot Kid View Post
Seven Forums now has a tutorial on the subject of the Hosts File, it can be view at the link below.

Hosts File : Use in Windows 7 / Vista




You get a whole lot more useful info in this one.
My System SpecsSystem Spec
16 Jan 2012   #29
Synikal

Windows 7 Home Premium x64
 
 

Quote   Quote: Originally Posted by DrWho View Post
Please, don't anyone think that I'm promoting myself as a HOSTS expert, but I do have some experience with it.

I first ran into using the HOSTS file some time (years) ago when I needed to change the Server designation for my Anti-Virus program, to use the Professional Server instead of the FREE server.

Anyway, I just opened Win-7 and accessed my HOSTS file.
When I tried to edit it by adding another entry, it saved my work to Hosts.txt and not the main Hosts file itself. Hmmmmm!

My solution was to rename the main HOSTS file to HOSTS.bac and then rename the hosts.txt file to HOSTS (NO Extension).
That worked like a treat.

However, all this was only an effort to verify, for myself, what's being said here in this thread.
Actually, I never really needed to go through all those acrobatics to work with my hosts file. I use the "Hosts Manager" program from "abelhadigital(dot)com" and I use it weekly to keep my HOSTS file up to date. It lets me view and edit my hosts file at will.

I've been doing this for quite some time now and I share the HOSTS Manager program with many of my customers, so they can keep their own HOSTS file up to date. It's a great protection against your browser being redirected to a porn site, or worse.

HOSTS Manager is almost a "Must Have" when children are using the home PC. I won't set up a PC without it. It's just one more level of security.

Sorry, I didn't mean to rant or ramble.

Cheers Mates!
The Doctor
THANK YOU! I tried everything, renaming it to BAK and it said I didn't have permissions! I even tried changing permissions before that, and it worked with any other file besides the hosts file. Thank you, that program did the trick

Oh yeah sorry for 1 and a half year bump...OOPS! :O
My System SpecsSystem Spec
06 Mar 2012   #30
stephen7

Chicago
 
 

For a detailed tutorial with pictures, follow this post Edit Hosts File in Windows 7
My System SpecsSystem Spec
Reply

 How to edit the Hosts file in 7




Thread Tools




Similar help and support threads
Thread Forum
Hosts file ignored and replaced with hosts.original
Hello. I am trying to use the hosts file. However both pings and web addresses still bypass the hosts file. I noticed that there is another file in the C:\Windows\System32\drivers\etc directory called 'hosts.original'. When ever I delete this file, it reappears seconds later. I have made sure that...
General Discussion
Hosts File
Hey, I was wondering, is there any internet performance gain if you put a commonly used website's IP (like Google) in your Hosts file, so it doesn't need to ask a DNS server? I mean, because I have 30 websites I go on at least 10 times each day, and it lags when I open all of them :D Thanks!
General Discussion
Hosts file-S??
can the hosts file be changed to, or amended by, another file? IOW can there be a file named xyz that essentially replaces the hosts file, or adds entries to it? Possibly by a registry key or configuration setting? Of course it could by altering library fxns, but by other "simpler" means? ...
System Security
HOSTS File - Create a "Edit HOSTS file" Shortcut
How to Create a "Edit HOSTS file" Shortcut in Windows 7 and Vista The HOSTS file is a .txt file used in Vista and Windows 7 to map hostnames to IP addresses. Your computer checks this file first to resolve any network names to its corresponding IP address before it tries to check the Internet....
Tutorials
HOSTS file
I setup a hosts file in windows xp in order to use my website locally using the exact domain name by editing the hosts file by adding the line: 127.0.0.1 www.test.com This should resolve my local ip address for the test.com site and if apache is running, then it should load the website...
Network & Sharing


Our Sites

Site Links

About Us

Find 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 01:13.
Twitter Facebook Google+ Seven Forums iOS App Seven Forums Android App