64.236.24.28 xxx.com
64.236.24.28 www.xxx.com
to the file c:\windows\system32\drivers\etc\hosts. If you type www.xxx.com then you are redirected to CNN. The change takes effect immediately. (Reboot is recommended).
Our users have generic hosts files as a consequence of receiving cloned drive images when the machines were first put into service or repaired after a crash. So you go with what you have. Rename the existing hosts file for backup then copy over a revised hosts. This method avoids cumbersome programming labor that creates a handle, opens a file, appends a file and closes a file.
Script solutions