|
Answer» Dear members, I want to read a text file and pass each line in it as parameter to a MSDOS batch(.bat) file through DOS commands. Is it poosible through DOS commands?? Pls help me. You really need to post your OS in this forum as all versions of the batch processor are not the same. This may work on your machine:
Code: [Select]@echo off for /f %%v in (textfile.txt) do ( batchfile %%v )
Hi friend, Thanks for reply.
i ran your code in DOS command prompt, I am getting error like this: "%%v was unexpected at this time"
D:\>@echo off for /f %%v in (textfile.txt) do ( %%v was unexpected at this time. 1.bat %%v %1 )
"1.bat" contents -------------- echo %%1 ---------------
My objective is to read each line and print it by the bat file which has received the line string as a parameter.
I am new to these commands. Can you please correct my code.
Thanks in advance..!
[OS using : Microsoft windows Server 2003]Your original post MENTIONED a batch file. Variables in a for LOOP use single % at the command prompt and %% in batch files.
Code: [Select]for /f %v in (textfile.txt) do ( 1.bat %v )
The above code is for the command line only.
Good luck.
Hi dude, It worked . I had spent more than a day in serach engines for this, no where i had found solution(may be i m not efficient) Thank u so MUCH for your help I need the command to move files, but only those that contain a specific string, example sonia_444_yyy
well in this case I would be searching for sonia, SINCE I know this is the good initial string
|