Geraldo Netto schreef:
> for i in $( cat $1 ); do
>         nslookup  $i >> nslookup_log.txt
> done
>
> it catches the content of a file passed($1) and does nslookup for each
> entry of the file
>
> and i would like to know how to rewrite it for command, by now i have this:
> @echo off
> for %%p in ( entries separated by spaces ) do nslookup %%p >> nslookup_log.txt
>
> any idea on how to pass a file as argument?
>   
@echo off
for %%x in ( %1 %2 %3 %4 %5 %6 %7 %8 %9 ) do nslookup %%x >> nslookup.txt

that allows 9 files so far (%1..%9)

if 9 isn't enough (note the commandline input limit of 127 chars or 
so..), make a subroutine in your batchfile and use some kind of dummy 
argument to jump to that part when the batchfile calls itself (or use 
goto commands).

@echo off
if "%1"=="" goto help
goto begin
:begin
if "%1"=="" goto end
nslookup %1 >> nslookup.txt
shift
goto begin
:help
echo Please input a computername, IP or file also like this: %0 [file] 
{file}. example: %0 192.168.1.1 192.168.1.2
goto end
:end
> Thank you very much,
>
> Geraldo
>   
Bernd


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Freedos-user mailing list
Freedos-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-user

Reply via email to