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.

0

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Shouldn't it be for /F %%F in (test.txt) do echo %%F
@JeffCaron: Yes, within a batch file you need to double the percentage sign.
1

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)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.