1.

Solve : Store each line of file content in an array?

Answer»

Hi Fellas,


Could SOMEBODY help please. Basically, I have an output file, the content of which I would like to hold in an array to ENABLE me carry out some action, line by line.

For instance, let's just say my output file has the following 2 lines:

************************

c:\temp\myFiles\print.java
c:\temp\myFiles\copy.java

************************

I then want to be able to use a for loop to recursively perform a certain action on each file. For instance, I would like to be able to copy each file to a SPECIFIED destination.

How can I get round this?Use a for loop to read thru the file, no array NEEDED. Based on your sample file, this may work:

Code: [Select]
for /f %%a in (output.file) do (copy %%a destinationpath)


If you had mentioned what PROCESS had created this output.file, it might be possible to incorporate it into the FOR loop also.

Hope this helps.



Discussion

No Comment Found