• Sign in to Neowin Faster!

    Create an account on Neowin to contribute and support the site.

  • 1
Sign in to follow this  

host file in windows 7 x64

Question

Nessie    0

Hi all

I wanted to add something to my host file and found i don't have one. i did a google search and it's sopposed to be in %windir%\system32\drivers\etc I have set my computer to show hidden file/folders and system files. why dont i have this folder or file.

my windows 7 pro x64 is a leagle os.

or am i missing something :)

Share this post


Link to post
Share on other sites

23 answers to this question

Recommended Posts

  • 0
kevinneke666    0

i have server 2008 r2 (legit :yes: ) and its indeed there \windows\system32\drivers\etc

i just did a search ...

Share this post


Link to post
Share on other sites
  • 0
Singh400    184

It is definitely there. Look again.

Share this post


Link to post
Share on other sites
  • 0
+John Teacake    454

Your missing something . . . leagle != Legal

Share this post


Link to post
Share on other sites
  • 0
+BudMan    3,544

As stated already the file is there, unless you deleted it?

But your not going to be able to edit it unless you elevate the software your using to edit, ie run notepad elevated or whatever text editor you like to use.

Share this post


Link to post
Share on other sites
  • 0
Singh400    184

As stated already the file is there, unless you deleted it?

I would imagine Windows would **** a brick if you deleted it :D

Share this post


Link to post
Share on other sites
  • 0
+BudMan    3,544

says who? If you have the permissions you can delete it, windows does not need that file to work.

edit:

if its not there, just create another one

hosts no ext.

Share this post


Link to post
Share on other sites
  • 0
Lazure    52

It... should be there. You must be doing something wrong if that folder isn't there! Try navigating to it manually, "Computer > C: Drive > Windows > System32 > Drivers > Etc" , should be some files, one of which just says 'hosts'. You will need to run notepad as administrator to edit this file, or take ownership of it and give it full permissions or you won't be able to save your changes to it.

Share this post


Link to post
Share on other sites
  • 0
Singh400    184

says who? If you have the permissions you can delete it, windows does not need that file to work.

edit:

if its not there, just create another one

hosts no ext.

I never said you couldn't delete it, I said Windows is likely to throw a wobbly about it.

Share this post


Link to post
Share on other sites
  • 0
+Human.Online    8,526
Your missing something . . . leagle != Legal

Your != You're

I never said you couldn't delete it, I said Windows is likely to throw a wobbly about it.

Nope. Without it, it simply acts as if the file were blank. No big deal!

Share this post


Link to post
Share on other sites
  • 0
goretsky    1,053

Hello,

Perhaps creating a shortcut to edit the hosts file will work for you. Try creating a new shortcut on your Desktop, Start Menu or wherever you like to store such things with a name like "Edit Hosts Files" and containing the following Properties:

Target:
%windir%\System32\notepad.exe "%WINDIR%\system32\drivers\etc\hosts."

Once you have created the new shortcut, open its Properties, select the Shortcut tab and click on the Advanced button to view the Advanced Properties for the shortcut. Select (check) the Run as administrator option and save the modified shortcut. Running the shortcut as Administrator is imporant, because otherwise you will not be able to save any changes made using this shortcut since the copy of Notebad needs Administrator privileges in order to change this file for security reasons .

I personally create a folder on my Start Menu named "Microsoft Tools" which contains shortcuts like this for various odd little Microsoft programs that don't have their own shortcuts in other places.

Regards,

Aryeh Goretsky

Share this post


Link to post
Share on other sites
  • 0
Nessie    0

I am an advanced computer user so when i say it's not there, it's defiantly gone :).. I had just done a clean install of win-7 x64 on a Corsair P128 ssd drive, my computer also has 5 other 500gb 7200rpm sataII drives. Windows was running great without it. Below is what i did..

PS: just had to laugh at the guy who corrected my spelling and spelled the word You're wrong.... classic. i come here to get good help, i don't care about other peoples spelling one bit, Lifes to short :)

thanks to everybody.

PS: computers still running great. Oh! and i have installed ieSpell (UK spelling) to keep people happy :)

Registery path: HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\DataBasePath=

DataBasePath = %SystemRoot%System32\drivers\etc.

first i made the etc folder.

To restore your HOSTS file with Microsoft's sample HOSTS file:

* Download HostsXpert from funkytoad.com and unzip (extract) it to your

desktop:

http://www.http://www.funkytoad.com/download/HostsXpert.zip/download/HostsXpert.zip

* Open HostsXpert from your desktop.

* When you receive the following message, click the "OK" button.

o Confirm

HOSTS file does not exist, press OK to create HOSTS file, Cancel

to Quit.

[OK] [Cancel]

* Close HostsXpert.

Or you can do this.

If you can't find the hosts file and a backup doesn't exist, then you'll have to create a new "hosts" file. To create one, you'll need to open the Windows Notepad program and enter the following information in it:

127.0.0.1 localhost

::1 localhost

The "1" in the "127.0.0.1" must be at the very first column of the line. Also, there must be at least one space between "127.0.0.1" and "localhost". The second line is an IPv6 address mapping to localhost, and this line is part of the default hosts file for Windows Vista and Windows 7. There must be at least a space between "::1" and "localhost".

In Windows 2000 or XP, all you need to do to save this file as "hosts" and you are done. In Windows Vista or 7, you must have started the notepad program "as Administrator". This will allow you to save to the "hosts" file and the path where you are trying to save is a system type file.

Once you've created the new hosts file, you are done and you've basically recovered. If you had some IP address-name mappings in the original hosts file for your computers in your home network, then you may append them to the hosts file; each mapping must have its own line.

IMPORTANT: The hosts file typically doesn't disappear on its own. There should be nothing touching that file, unless you explicitly decided to modify it or you have a computer security program that modifies it to prevent you from going to malicious web sites. Thus, you should do a full system virus/malware scan as your computer may be infected! Just do this as a precaution.

Summary

To quickly recover from your missing host file, you'll need to create a new one in c:\windows\system32\drivers\etc and put some default entries in it. This will get your computer to its baseline hosts file configuration. You may also append other IP address-name mappings you may have had in the original hosts file. As a precaution, it is recommended that you do a full virus/malware scan of your system as nothing should be touching your hosts file; the fact that your hosts file disappeared may be a symptom that your computer is infected.

hope this helps others with the same problem.

Share this post


Link to post
Share on other sites
  • 0
+BudMan    3,544

How about you just link the article you found?

http://www.brighthub.com/computing/smb-security/articles/56592.aspx

Help! My Hosts File is Missing!

As to you being an "advanced" computer user??

"i did a google search and it's sopposed to be in %windir%\system32\drivers\etc"

Sure doesn't sound like it to me, pretty much a simple mediocre user would not have to search for where the host file resides :rofl: And then asking why you don't have it? Again not pointing our your advanced user skills - hehehe

Sorry but installing an OS and having 5x500Gb drives does not make you an advanced user ;)

Glad you got it sorted, but I'm curious to how your whole etc folder would go missing in the first place?

Share this post


Link to post
Share on other sites
  • 0
hdood    145

The above guide is not completely right. The default hosts file is empty. There are no default entries, and the localhost lines don't belong there.

Are you also missing the other files in etc? I really can't see any reason why it would not be there on a fresh install, which makes it sound like your system could be compromised.

It's also worth noting that the file does not exist to be used to block undesirable domains, and that having a large number of such entries will impact performance.

Share this post


Link to post
Share on other sites
  • 0
Singh400    184
The default hosts file is empty. There are no default entries, and the localhost lines don't belong there.
No, sorry that is wrong. The default HOSTS file does contain one entry...

# Copyright (c) 1993-1999 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

127.0.0.1       localhost

The above being taken from my WHS box.

# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

# localhost name resolution is handled within DNS itself.
#	127.0.0.1       localhost
#	::1             localhost

And the above being taken from my Windows 7 PC. I guess it changed in Windows 7, as the # means comment and it is ignored by Windows.

Share this post


Link to post
Share on other sites
  • 0
hdood    145

And the above being taken from my Windows 7 PC. I guess it changed in Windows 7, as the # means comment and it is ignored by Windows.

So what you're saying is that I was right. Quite the long (and copyright infringing) +1.

Share this post


Link to post
Share on other sites
  • 0
Prince Charming    163

No, sorry that is wrong. The default HOSTS file does contain one entry...

It's empty in the sense that on Windows 7, it's not used. Every line is commented out, and localhost isn't mapped within the hosts file. Out of the box, there are no entries, and it doesn't do anything.

Share this post


Link to post
Share on other sites
  • 0
Lord Zog    7

The hosts file default is empty.. Been that way since they started using a hosts file....

Share this post


Link to post
Share on other sites
  • 0
+BudMan    3,544

^ no it has not always been empty -- Why do people not even take .3 seconds to check their facts before posting information that makes them look stupid?

Hosts file have been around for quite some time, defaults to localhost

127.0.0.1 localhost

Vista added the ipv6 loopback address

127.0.0.1 localhost

::1 localhost

Win7 just remarked these out, since now in the dns client.

Share this post


Link to post
Share on other sites
  • 0
LukeEDay    17

I am an advanced computer user so when i say it's not there, it's defiantly gone :)..

If you are an advanced computer user, I am Bill Gates. :no:

A host file is usually used by pirates to block a certain program from calling home. Any other time, it is left empty ..

Share this post


Link to post
Share on other sites
  • 0
+BudMan    3,544

what? Host file usually used by pirates?? Where do you people come up with these blanket statements of pure nonsense.

Hosts file have "always" been empty since the beginning

Its blank unless your a pirate.

I use the hosts file quite often in development and testing as a means of name resolution when there is no nameserver you have access to modify records. Or just need quick and dirty to resolve a name to a specific IP.

Great method for pointing to the development copy of websites running on the local network using its local IP vs the public resolvable one, in general just a great way to be able to resolve your local network devices by name when you do not run a local dns, say your dvrs or printers, toaster, etc.

There are prob a endless number of reasons why you might need to resolve a IP to specific name be it host or even a fqdn, etc. Normally you would want this resolution to be correct, but sure it could be used to take precedences over your normal dns to point a host to a different IP then dns says it is.. So sure some people use to block ad servers, or any other server they don't want the machine talking to by putting in an invalid record.

Those are just couple examples of the many uses of the file, only used by pirates :rofl:

Share this post


Link to post
Share on other sites
  • 0
Singh400    184
A host file is usually used by pirates to block a certain program from calling home. Any other time, it is left empty ..
What are you on about? I personally use it to block a whole load of bad sites, keep out malware and general other crap on the internet.

Share this post


Link to post
Share on other sites
  • 0
Colin-uk    135

thread cleaned

Share this post


Link to post
Share on other sites
  • 0
+Human.Online    8,526
A host file is usually used by pirates to block a certain program from calling home. Any other time, it is left empty ..

LOL @ funniest thing I have read all day!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.