3

I've got a general query regarding the location of the hosts file on Windows. It resides at this location:

f:\windows\system32\drivers\etc\hosts

My question is why? Could Microsoft have picked a more obscure location for a hosts file?

Jonathan Holloway
  • 365
  • 1
  • 4
  • 10

4 Answers4

6

Well, I'm not a microsoft insider, but here is my logic:

%WINDIR% - All windows files are here
system32 - these are for 32 bit system binaries
drivers - well ... drivers
etc\hosts - you need to understand that the Windows TCP/IP stack is an implementation of the BSD TCP/IP stack, in *nix systems the host file is at /etc/hosts

This is my best guess as to why it was put there.

Zypher
  • 37,405
  • 5
  • 53
  • 95
  • 3
    Agreed, along with the fact that microsoft doesn't seem altogether comfortable with plain text config files, so it stands to reason that they would choose an awkward location for one of the most commonly-used files. :) – EEAA May 28 '10 at 04:22
  • Another reason it's in an obscure location is that you don't often edit the hosts file in windows. – Ward - Trying Codidact May 28 '10 at 05:14
2

If you don't like that location you could always change it by going to regedit and modifying this value: \HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\DataBasePath

  • This no longer works in Windows 7. `>:-|` – Synetech Sep 19 '11 at 19:40
  • In Powershell, I can access the regkey until `parameters`, but not the `databasepath`. This works: `get-itemproperty \HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters`. Any idea? – Timo Oct 20 '20 at 06:51
0

My guess is that it's a system file, so that's why it is at that location.

For what it's worth, you can create a shortcut to the file, the shortcut being in a more convenient location. As an example, when I use Apache on my Windows desktop, I'm wanting to add virtual hosts, which requires modifying the hosts file so they can be accessed. So I have a shortcut to the hosts file located in my Apache config folder.

Grant Palin
  • 342
  • 2
  • 3
  • 18
0

Yes, they could have.

joeqwerty
  • 109,901
  • 6
  • 81
  • 172