Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HOSTS FILE/BATCH

Status
Not open for further replies.

djeddieed

IS-IT--Management
Dec 1, 2002
22
0
0
US
I need to know how to write a batch file to overwrite the current hosts file on win98 and winXP. I want to be able to send that batch file to users where they can just click and it runs/overwrite. PLEASE HELP.
 
Writing to a file is simple - use echo. For example:
echo 207.68.172.234 > c:\windows\hosts

Each command will overwrite the, to append a second line use this syntax:
echo 192.117.152.14 >> c:\windows\hosts

In Windows XP use something like this:
echo 207.68.172.234 > %SystemRoot%\System32\drivers\etc\hosts
echo 192.117.152.14 >> %SystemRoot%\System32\drivers\etc\hosts
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top