1
Question
Is there any way to use multiple hosts files on windows(7) ?
Preferably without installing any external programs.
Example
Say my hosts
file has in it
10.2.3.4 bob.com
10.2.3.5 jim.com
And i want to also you another file say hosts2.txt
containing
10.2.3.4 mark.com
Is there any way for windows to read both files to use ?
The reason i want to do this and not just add more to the normal host file is that i am creating a script which relies on certain IPs going to certain domains. This will be used by multiple users, so i was hoping that i can just create one file in a shared directory that is read as well as the users own host file. This means if the addresses change in the future only one file would need to be changed instead of every users host file as well as allows transparent changes without the users knowledge.
Ideas
Maybe there is a registry or something that contains the name of the hosts file ?
Any more information needed let me know and i will add it.
Cheers for the answer! I have a DNS server but editing that is not currently possible. I had also considered the scripting option but that will be a fallback if there is no other way.Surely the file used for hosts must be specified somewhere on the system though! – None – 2015-03-20T09:11:07.897
1
If it was, I'm fairly sure we would have become used to seeing malware amend the location, leaving the hapless victim checking the wrong file. I don't believe this is the case. This superuser article indicates that there is a registry key for it, but it doesn't work in Windows 7: http://superuser.com/questions/319949/databasepath-registry-entry-not-working-in-windows-7
– sahmeepee – 2015-03-20T09:15:04.343Oh yeah, nice find, loooks like I'm going to have to take the scripting route then. Thanks for your help! – None – 2015-03-20T09:52:46.113
Using a DNS server really is the way to go here. Scripting is definitely not preferred, because a user can always edit the hosts file themselves and undo your changes, or even worse, they add items to their hosts file and loose those changes upon the next update. You could look into using mklink to create a symbolic link to the hostsfile on a network location, but it may fail and cause DNS to stop working completely (so make sure you note down any ip address of dns servers you need to work with just in case) – LPChip – 2015-03-20T11:30:31.553