|
Answer» hi ..
i'm not sure this is possible under dos but i have a text file which is being generated, the TXT files numbers of lines will change depending on the system ..
file example ******************
C:\path\server1.file c:\path\server2.file
****************** what i'd like to do is pass each line in turn to another cli .. eg
command c:\path\server1.file
then run
command c:\path\server2.file
the only way i could think to do this was to TRY and pass each line to a variable using FOR. and the on the cli and could use command %a, command %b ....
any thoughts ?
The FOR command will do you quite nicely:
@echo off for /f %%a in ('dir /b *.file') do command %%a
Feel free to adjust the code snippet to your situation.
Hope this helps.
perfect .. i've just had the BLINDINGLY obvious POINTED out to me on a public forum .. .. sometimes you can stare at something so long ..
i actually needed a couple of mods as there are spaces so i ended up with
for /f "tokens=1 delims=," %a in ('file.txt) do command %a
thanks for your help
|