General discussion

Locked

DOS script to read data from one file and use it as switches in other batch

By ravinder.kodan ·
Hi All,

I am trying to create BATCH file, below are the things I would like to add.
1) I have a file named as list.txt, having content as given below,
name a
class b
marks c
grade d
2) I want to read thie file and store each line in a variable so that It can be used further in any command, for eg the command is
abc "a" "b" "c" "d" are the data which I fetch from above file.

Below is script I have created to read the file but I can use the first line only,

@echo off
for /f "tokens=*" %%a in (list.txt) do (
echo %%a
call :temp %%a
)
:temp
set a=%2%
:: echo %a%
call C:\command -m %a% -n %b% -o %c%
:EOF

By this I got the command only as "command -m a " rest are not getting set.
Soonest reply will be very helfup for me.

This conversation is currently closed to new comments.

0 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Back to Windows Forum
0 total posts (Page 1 of 1)  

Related Discussions

Related Forums