tags:

views:

133

answers:

2

I have a text file and a .bat file. Int the text file I have a list of workstation numbers like:

CG002681
CG002526
CG002527
CG002528
CG002529
CG002530
....

so I need to read this text file and i need to excute the command as shown below.

copy "\\cg002009\c$\Documents and Settings\All Users\Application Data\abc\LM\I4S.INI" c:\asd\mul.txt 
echo cg002009 >> c:\asd\Shashi.txt
type c:\asd\mul.txt >> c:\asd\345.txt \l

I need execute this command for each workstation.

A: 

You can use the for command:

for /F %F in (test.txt) do echo %F

will print each line in file test.txt to the console.

0xA3
A: 

for /F "delims= " %%i in (workstation.txt) do call handle.bat %%i

in handle.bat first param (%1) will be name of workstation there you can do all work (copy, echo and so on)

Alexey Sviridov