Ive created a cd that autoruns a graphical menu with clickable links, and one of the links points to a HOSTS.bat file that copies over a custom HOSTS file from the cd to the ..driversetc folder on the system root.
The problem I’m having is that I’m unsure of the correct syntax to use to automatically overwrite the existing HOSTS file.
I need to write it to work on both Win2K and XP machines, so have included two lines; one copies the HOSTS file to WINDOWSsystem32driversetc, and one copies it to Winnt..etc. Thsi seems to work ok, for if it’s an XP machine it ignores the Winnt instruction and vica versa.
However, this has all been tested with my original HOSTS file temporarily renamed to HOSTS2, so there is no HOSTS file to be overwritten. I cannot seem to make it work if there is a HOST file already present.
Is there a switch to make it overwrite? Or changing tack entirely, is there a way I can instruct the IP address I need to be written into the original HOSTS file?
Here is the contents of the batch file as it stands:
copy “hosts” “C:WINDOWSsystem32driversetchosts”
copy “hosts” “C:WINNTsystem32driversetchosts”
If anyone can help I would be most appreciative!
You must be logged in to reply to this topic.
Create a free account today to participate in forum conversations, comment on posts and more.