As the title says, there are currently 39 computers, with computer names from 1 to 39, no prefixes or suffixes, just single digits. The gateways are 192.168.1.252---254, a total of 3, one gateway per 13 units. Since it's diskless, it's more troublesome to set the gateways respectively. I want to ask experts to help make a batch script to automatically modify the gateway according to the computer name.
Thanks, urgent.
I just wrote two lines, can't go on.
ipconfig /all >ip.txt
for /f "delims=" %%a in ('findstr "Host Name" ipconfig.txt') do echo %%a>>NAME.txt
Extracted the line with the computer name, still want to extract the computer name alone, and then use the computer name to arrange. If it's less than how many, use how many gateways. Always can't get it right.
Finally, I want to use the IF command plus the following line to realize automatic gateway switching
netsh interface ip set address name="Local Area Connection" source=static gateway=*.*.*.* gwmetric=1
Thanks
Thanks, urgent.
I just wrote two lines, can't go on.
ipconfig /all >ip.txt
for /f "delims=" %%a in ('findstr "Host Name" ipconfig.txt') do echo %%a>>NAME.txt
Extracted the line with the computer name, still want to extract the computer name alone, and then use the computer name to arrange. If it's less than how many, use how many gateways. Always can't get it right.
Finally, I want to use the IF command plus the following line to realize automatic gateway switching
netsh interface ip set address name="Local Area Connection" source=static gateway=*.*.*.* gwmetric=1
Thanks

