General discussion
Thread display: Collapse - |
All Comments
Start or search
Create a new discussion
If you're asking for technical help, please be sure to include all your system info, including operating system, model number, and any other specifics related to the problem. Also please exercise your best judgment when posting in the forums--revealing personal information such as your e-mail address, telephone number, and address is not recommended.
DOS script to read data from one file and use it as switches in other batch
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.