Thursday, March 18, 2010

Batch to add/remove IP address in hosts file

Add IP address

IF NOT EXIST C:\WINDOWS\system32\drivers\etc\hosts_o Copy C:\WINDOWS\system32\drivers\etc\hosts C:\WINDOWS\system32\drivers\etc\hosts_o

Copy C:\WINDOWS\system32\drivers\etc\hosts C:\WINDOWS\system32\drivers\etc\hosts_bk /y

echo 1.5.3.8    x.xxx.com >> C:\WINDOWS\system32\drivers\etc\hosts

 

Remove IP address

Copy C:\WINDOWS\system32\drivers\etc\hosts C:\WINDOWS\system32\drivers\etc\hosts_bk2 /y

Copy C:\WINDOWS\system32\drivers\etc\hosts_o C:\WINDOWS\system32\drivers\etc\hosts /y

Print Friendly and PDF
Share/Bookmark

No comments:

Post a Comment