in reply to update winxp hosts file with new IP address
...and finding the default IP address and replacing it with the new value.What do you mean by 'default IP address'? What hostname is it associated with?
Since the hosts file shouldn't change that much, here's a simple approach that might work for you:
If the default IP address is limited to a couple of different choices, then you can just prepare one host file for each possible value for the default IP address, and copy the desired file to the real hosts file as required.open(B, "<c:/path/to/hosts-base"); open(N, ">c:/path/to/hosts"); while (<B>) { print N; } print N "default $ARGV[0]\n"; # add the 'default' entry
|
|---|