Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I am trying to echo one at a time the following txt file
192.168.0.169 192.168.0.173 192.168.0.139however the batch file I have made, displays them all at once
Set n= Set _InputFile=list.txt For /F "tokens=*" %%I IN (%_InputFile%) DO ( Set /a n=1 Set _blah!n!=%%I Echo %%I )Is there anyway to display one at a time?
Thanks

isn't it already diplaying one line at a time???
add this line inside the for loop to understand:
ping localhost>nul

Thanks for your quick response
but unfortunately it displays them all at once
is there anyway to break them up?
thanks

Set /a n+=1 ??? <- Did you forget your plus sign(or whatever operator your using)?
"is there anyway to break them up?"
echo.This will echo an empty line.

"isn't it already diplaying one line at a time???"
I'm gladf it's not just me.
As posted it sure will put out 1 line at a time.
NOTE: the setting of n and _blah!n! is not doing anything. I wonder what was intended.
=====================================
If at first you don't succeed, you're about average.M2

the line is normally
set /a n+=1
I was just mucking around with the code and forgot to change
it back.Thanks for all of your responses but I don't think I made my
question clear.after that code is executed I can use the vars %_blah1% to
%_blah3%.Is the any way to have it in a loop so I don't have to set the
number every time?eg.
:start if %_blah!n!%=="" goto EOF Do somthing set n=n+1 goto start

Since you have a variable with n variables inside why not use a for /l loop.
for /l %%a in (1 1 !n!) do echo !_blah%%a!Unfortunately the is no easy way to do something similar to create the variables with out mucking around.

I don't want to echo it but I do want to do some commands before it changes to the next _blah

The echo is just an example to demonstrate, expand/modify to suit your needs.
for /l %%a in (1 1 !n!) do ( <insert esp here> !_blah%%a! !_blah%%a! !_blah%%a! !_blah%%a!....... )Edit:
I don't know about anyone else but if they want me to take a survey (or click no thanks) every time I fix a little mistake I don't think this will last much longer.

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

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