1.

Solve : How can i read the contents of a file using DOS??

Answer»

I have a file called List.txt , in this file I have N lines.
I need to have a batch file to read each LINE and create a file for each line. The name of this file must be same as the content of the line.

For e.g.
List.txt has 3 lines.
Line 1 is ABC.rep, line 2 is PQR.rep and line 3 is XYZ.rep
The batch file will read the the 3 lines and create files ABC.rep, PQR.rep and XYZ.rep

These 3 files can be blank files.Without knowing your OS, it's hard to come up with a definitive answer.

This may WORK on some machines:

Code: [Select]@echo off
for /f "tokens=1* delims=" %%a in (list.txt) do echo. > %%a

8-)My apologies -- the OS is Windows 2000.did you try that batch from sidewinder yet? whats the results?I have tried the commands -- I am very happy with the results.
Many many thanks for your help.I was wondering if the above commands can be enhanced. Can there be a lag of 2 MINUTES between creation of each file?

Basically each file that is created triggers a process and the REQUIREMENT is to not start all processes at the same time as this will hog all resources. Hence a delay of 2 minutes between creation of each file is ideal.

Please can you help.You can use the PING command as a timer.

Code: [Select]@echo off
for /f "tokens=1* delims=" %%a in (list.txt) do (
echo. > %%a
ping -n 121 localhost > nul
)

There is also a SLEEP command in the Win2003 Resource Kit which you can find with Google.

8-)This works just as I desired. Many thanks for your help.



Discussion

No Comment Found