looking to do

November 9, 2010 at 07:15:23
Specs: Windows XP
Looking to read "host" and "server"from a file, and input to "NSLOOKUP" command in a batch file - need imbeded loop to not overwhelm DNS server

See More: looking to do

Report •

#1
November 9, 2010 at 07:29:46
My code...attempt

@cls
:
SetLocal EnableDelayedExpansion
:
Set n=
Set _InputFileH=d:\Data\ulxxx\yyyy-both.txt
:
For /F "tokens1-2 delims =," %%A IN (%_InputFileH%) DO (
Set _var1=%%A
Set _var2=%%B
echo "-var1--" %_var1%
NSLOOKUP %_var1% %_var2%
Set _
)
Set _
EndLocal



Report •

#2
November 9, 2010 at 09:13:53
Your issue is pitch-black for me, but with delayed expansion enabled inside the FOR loop mark environment variables with ! not %, i.e. !_var1!.

More delins= NOT delims = and what is SET _?


Report •

#3
November 9, 2010 at 13:30:41
My modified code... reading both vars from 1 file...

@cls
:
SetLocal
:
Set _InputFileH=d:\Data\ulxxx\yyyy-both.txt
:
For /F "tokens=1, 2 delims =," %%a IN (%_InputFileH%) DO (
echo NSLOOKUP %%a %%b
NSLOOKUP %%a %%b
)
EndLocal

==== Results =====

D:\Data\ulxxx>SetLocal

D:\Data\ulxxx>Set n=

D:\Data\ulxxx>Set _InputFileH=d:\Data\ulxxx\yyyy-both.txt

D:\Data\ulxxx>For /F "tokens=1, 2 delims =," %a IN (d:\Data\ulxxx\yyyy-both.txt) DO (
echo NSLOOKUP %a %b
NSLOOKUP %a %b
)
delims =," was unexpected at this time.

D:\Data\ulxxxx>EndLocal


Report •

Related Solutions

#4
November 9, 2010 at 13:39:35
I think I have worked it out - thanks for the input

Report •

#5
November 9, 2010 at 13:59:29
I got it to read both vars from same file, but can't get to read from 2 separate files - any suggestions

Report •

#6
November 9, 2010 at 14:36:14
Got it working from two files -

Report •

#7
November 9, 2010 at 14:37:14
Got it working from 2 files - quite simple

Report •

Ask Question