开发者

Write batch file to read a number from a text file and execute the command with that number

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.


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.


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)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜