Hi,Going by your description, here is what I think you are trying to do:
code:
; Program to use NSLOOKUP
break on
cls
$path=h:\scripts
"Using $path\wwwname.txt" ?
del "$path\output.txt"
$=open(1,"$path\wwwname.txt")
if @error<>0 ? color r+/n "Error @error occured: @serror" ? color w/n quit endif
$r=readline(1)
while @error=0
$c="www."+$r
? "Performing Lookup on $c"
shell "cmd /c nslookup $c >>$path\output.txt 2>nul"
$r=readline(1)
loop
$=close (1)
? ? ?
shell "cmd /c type output.txt"
?
This program takes names from wwwname.txt in $path and does the nslookup on them and outputs all the lookups to $path\output.txt.
wwwname.txt is in the format of:
ibm.com
ozemail.com.au
with no blank lines.
Here is the output.txt from the above:
Server: myserver
Address: 1.2.3.4
DNS request timed out.
timeout was 2 seconds.
Name: www.ibm.com
Addresses: 204.146.80.99, 204.146.81.99, 198.133.16.99, 198.133.17.99
Server: myserver
Address: 1.2.3.4
Name: www.ozemail.com.au
Addresses: 203.108.7.78, 203.108.7.76, 203.108.7.74, 203.108.7.77
Aliases: www.ozemail.com
If you like, I can make a post output processor that presents just the first IP address... Can you explain how you want the output formatted? Do you want just an ipaddress etc?
cj