Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi,
Am working on a bat file to read lines out of a file and pass them to call1.bat:
FOR /F "delims=" %%a in (iplist.log) DO call call1.bat %%a
call1.bat is seeing %%a as %a - rather then as the line of text read from iplist and being passed to it.
Any suggestions on how I can get past this? Would be very much appreciated,
Thanks

Hi Steve,
call1 needs to act on
%1
just as it would with a command line parameter.
Your:
call call1.bat %%a
is correct.
HTH
M2
If at first you don't succeed, you're about average.

it does not work though :(
My script is supposed to read lines out of the log file - which works fine, but when passed to another bat file ie. call1.bat - this sees %1 as %a, NOT the line of text its read from the log file.

Hi Steve,
I have no idea why you're getting that.
I tried this:
::**
FOR /F %%a in (iplist.log) DO call :1 %%agoto :eof
:1
echo %1
pause
::**Note that with NT you can CALL a label like a separate BAT.
In the script above I don't get %a ; I get the value.
BUT, I only get the first "word" of each line.
I get complete lines with this:
::**
@echo off
FOR /F "tokens=* delims= " %%a in (iplist.log) DO call :1 %%agoto :eof
:1
echo %*
pause
::**
M2
If at first you don't succeed, you're about average.

M2,
Your right it works - my mistake!
I was using:
echo %aa
instead of:
echo %1Thank you very much for all your help :)

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |