Best way to fix a Windows Host file with combined entries?

One of the guys had created a Bat file that was to append a new IP and Name (which was in a file called "new_ip.txt" to the end of the Hosts file on either 95 or W2k/XP with the following script...
*******************************
echo off
if exist %windir%\hosts.sam goto win95
if exist %windir%\system32\drivers\etc\hosts goto win2kxp

:win95
c:\
copy %windir%\hosts.sam+c:\new_ip.txt %windir%\hosts.sam
goto exit

:win2kxp
c:\
copy %windir%\system32\drivers\etc\hosts+c:\new_ip.txt %windir%\system32\drivers\etc\hosts
goto exit

:exit
cls
REM Please close this window
*******************************
This apparently worked when he tested it before deployment; but now I'm getting calls about people not being able to get to servers and have diagnosed the problem back to their Host files and the fact that his script works for all unedited Host files that had a carriage return at the end by default, but those that had been edited and saved with new entries, did not.  Thus it caused the two strings to be joined together on one line, so...
"IP1.IP1.IP1.IP1      Name1" in an edited host file became
"IP1.IP1.IP1.IP1      Name1IP2.IP2.IP2.IP2            Name2"
and now I'm left to try and clean this up.

My question would be, how could this script be changed or a new one developed to 1) go back and fix this error and 2) make sure any new ones get done properly?

IP2 and Name 2 are known values, but IP1 and Name1 could be anything and would need to be left with the new entry beneath it.  Thanks.
AZEMBBAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

gjohnson99Commented:
Why not use a dns server  ?
0
AZEMBBAuthor Commented:
DNS would have been nice, but the desktops are spread out worldwide on various networks and domains which are not able to be administered.
0
SKULLS_HawkCommented:
http://www.ntmag.com/WindowsScripting/Article/ArticleID/8187/8187.html

Try this link, it deals with exactly what you want.  It has a download with pre scripted files in, and instructions on how to configure.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Networking

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.