go search and find file name hosts
it is windows\system32\drivers\e
once update it remains
Main Topics
Browse All TopicsNeed to write a bacth file to edit an entry in the Windows host file
Example:
change
1.1.1.1 mail.domain.com
to
# 1.1.1.1 mail.domain.com
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
I need a batch file that will change the one enrty
Users are setup for internet mail.
When they are inside the firewall they need to remove the comment status (#), and use the ip address to resolve pop request to the exchange server.
When out of the office, the comment switch (#) should be added to allow pop request to mail.domain.com
In office
1.1.1.1 mail.domain.com
Out of office
# 1.1.1.1 mail.domain.com
This will actually require two batch files, which is a little cumbersome.
I have found some windows scripting code that may work, but I am not sure how to make it work.
I need to implement this solution today, and then work out a better process
Why not do this using dns? Assuming that you have AD DNS servers when "in the office" then create a new zone, name the zone mail.domain.com, make the a record for the zone point to 1.1.1.1, and remove the entry entirely from the hosts file.
Then when users are inside the network, they will resolve mail.domain.com to where you want it. and outside will resolve to internet or whatever dns servers they are using when connected.
It would seem that a bat or vbs solution would be more troublesome.
I would use the vbscript from this article, modified slightly:
http://www.microsoft.com/t
I don't have the access to a DNS server and I often need to change the lmhosts file. Here is what I do. I create several copies of the file, such as lmhosts.ofe and lmhosts.hom, each with different contents. A batch file to change them can be simply like this:
ipconfig /release LAN
copy /Y %SystemRoot%\System32\driv
nbtstat -R
ipconfig /renew LAN
exit
where 'LAN' is the name of the network connection for internet
Business Accounts
Answer for Membership
by: dwelldonPosted on 2006-09-29 at 03:41:08ID: 17626277
Will the host file have the same entry, hence it will only need to be entered once or will it change each time a user logs on