Problem with multiple variables

May 3, 2010 at 03:12:34
Specs: Windows XP
Hi, I have a small challenge with my batch command.
I have a text file that looks like this:

K1; 50; 200
K2; 100; 500
and so on

I want to use those variables from the text file to fill command line that looks like this:
Command -"some command" -"next command" -"and more commands" -PVAR1=VAR1 -PVAR2=VAR2 -PVAR3=VAR3 -execute

So how can I read the variables and do the loop until the end of file?
There can be more than 100 variables in one file.

See More: Problem with multiple variables

Report •

May 3, 2010 at 09:40:27
It's actually very simple, I'll give a clue

FOR command with /F parameter
semicolon is your delimitor

Report •

May 3, 2010 at 12:13:13
like one execution per set of three (each line) ?:

@echo off & setlocal enabledelayedexpansion
for /f "tokens=1-3 delims=;" %%a in (file) do (
set out=-PVAR1=%%a -PVAR2=%%b -PVAR3=%%C
comnd -x -y -!out! -execute

Report •

May 3, 2010 at 13:46:20
Thank you, both. That solves my problem. This saved me lots of time.

Report •

Related Solutions

Ask Question