Add and Remove Hosts Entries

This is a quick script I’ve used to add and remove entries to the windows hosts file. It ignores commented lines (lines starting with a hash (#)), and it also doesn’t validate the format of the host or IP address so use with care!

Usage

cscript.exe hosts.vbs “Add” “10.10.10.10” “example”
cscript.exe hosts.vbs “Remove” “10.10.10.10”

 

Leave a Reply

Your email address will not be published. Required fields are marked *