To perform looping

February 2, 2010 at 16:22:46
Specs: Windows Vista

I need to run a pgm by reading inputs from a file.

For instance, abcd.exe i/p1 i/p2 -first execution
abcd.exe i/p2 i/p3
like that till abcd.exe i/pn-1 i/pn

these i/p's should be read from a file. I wanna implement it as : i am writing it as a pseudocode,

for %%a in (file.txt) do ( ...
set the value to a var.
next value to another var1.
perform abcd.exe var var1
var1=the third value.. nth value
is it possible to bring this out in batch scripts.
I am jus getting started with the batch scripting. It would be of great help if anybody finds me a solution for this,

See More: To perform looping

Report •

February 2, 2010 at 20:56:52
I performed the following for the above problem. But it doesn't seem to work. It outputs only tic.

@echo off
set a = "tic"
for %%a in (*.hdr) do (
set value = %%a
abcd.exe %a% %value%
set a = %value%

Report •

February 2, 2010 at 21:22:26
hello: look at output from commandline helps for:
set /?
for /?
setlocal /?
these will help you immensely.
right now, one problem is non-expansion of var %value%
because it's inside the for-loop. i'm not trying to be nasty, but there's about a million other things going wrong as well.
(that happens when you're just starting out...)
main thing, to be able to help, is for you to post a sample snippet of the data-file you're trying to work with (*.hdr or test.hdr or whatever it is).
i'll make a sample to let you work with:
@echo off
for /f "tokens=1,2 delims=," %%a in (test.hdr) do (
echo.testing:abcd.exe %%a %%b
goto :eof
:----------------- snip - end of batch
where test.hdr looks like:

Report •

February 3, 2010 at 07:02:38
Batch, chance is high it can be done what you are asking, but you need to be precise, when describing the goal. I don't really understand it ... Either give us the code you already have and/or a sample of the input file, and/or provide more detailed instructions on the goal.

Report •

Related Solutions

Ask Question