You guys are picky... wanting code to actually work

It also seems to work under XP... (of course 2k and xp are about the same thing...)

code:

; find ipconfig info (for up to 10 adapters)
$interfaces="HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces"
$nic=0 dim $ipaddrs[9] dim $gateway[9] dim $subnetm[9] dim $namesvr[9]
:nicloop
$niccard=enumkey("$interfaces",$nic)
if @error=0
$Isdhcp=readvalue("$interfaces\$niccard","EnableDHCP")
if $Isdhcp="1" $adddhcp="Dhcp" else $adddhcp="" endif

$ipaddrs[$nic]=readvalue("$interfaces\$niccard","$adddhcp"+"IPAddress")
$gateway[$nic]=readvalue("$interfaces\$niccard","$adddhcp"+"DefaultGateway")
$subnetm[$nic]=readvalue("$interfaces\$niccard","$adddhcp"+"SubnetMask")
$namesvr[$nic]=readvalue("$interfaces\$niccard","$adddhcp"+"NameServer")

; trim off pipe char from end of reg_multi
$ipaddrs[$nic]=left($ipaddrs[$nic],len($ipaddrs[$nic])-1)
$gateway[$nic]=left($gateway[$nic],len($gateway[$nic])-1)
$subnetm[$nic]=left($subnetm[$nic],len($subnetm[$nic])-1)

if $gateway[$nic] > "0.0.0.0"
$mygw=$gateway[$nic]+"|"+$mygw
? "$adddhcp NIC number $nic"
? "IP :"$ipaddrs[$nic]
? "GW :"$gateway[$nic]
? "SM :"$subnetm[$nic]
? "NS :"$namesvr[$nic]
endif
$nic=val($nic)+1
goto nicloop
endif

$mygw=left($mygw,len($mygw)-1)
? "My Gateways are: "$mygw


output for me is:

code:

NIC number 1
IP :192.168.110.12
GW :192.168.110.1
SM :255.255.255.0
NS :65.32.2.130,65.32.1.70
My Gateways are: 192.168.110.1

[ 19 December 2001: Message edited by: Radimus ]

_________________________
How to ask questions the smart way <-----------> Before you ask