Bladerunner2019
Solid State Member
- Messages
- 7
Hi
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 ..\drivers\etc 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 WINDOWS\system32\drivers\etc, 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:
rem
copy "hosts" "C:\WINDOWS\system32\drivers\etc\hosts"
copy "hosts" "C:\WINNT\system32\drivers\etc\hosts"
If anyone can help I would be most appreciative!
TIA ;-)
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 ..\drivers\etc 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 WINDOWS\system32\drivers\etc, 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:
rem
copy "hosts" "C:\WINDOWS\system32\drivers\etc\hosts"
copy "hosts" "C:\WINNT\system32\drivers\etc\hosts"
If anyone can help I would be most appreciative!
TIA ;-)