PDA

Click to See Complete Forum and Search --> : Batch file Question


Mark Sreeves
Jun 28th, 2000, 05:08 PM
There's no home for batch file questions :(

anyway,

How do I loop through all the files in a directory and process them one at a time?

catocom
Jul 1st, 2000, 02:46 AM
Are you programming in VB , QB or
something else?

Mark Sreeves
Jul 3rd, 2000, 06:14 AM
DOS batch file!

catocom
Jul 3rd, 2000, 03:46 PM
Sorry it took me so long to reply.
----------------------------------------


111.bat
---------------
@echo off
type Hello.txt' replace with file to loop(include path if not in same dir)(if file is exe just put the path)
222


222.bat
---------------
@echo off
type Hello.txt' replace with file to loop(include path if not in same dir)
111


Hello.txt
---------------
Hello

-----------------------------------------------------------

All files in dir eg.

111.bat
------------------
@echo off
c:\whatever\*.exe_____________(and, or *.com...)
c:\whatever2\222.bat

222.bat
------------------
@echo off
c:\whatever\*.exe
c:\whatever2\111.bat


Several years ago someone told me that anything
you can type on the command line, and works, you
can put in a batch file.

[Edited by catocom on 07-03-2000 at 04:32 PM]

Mark Sreeves
Jul 4th, 2000, 03:27 AM
I don't think that is quite what I'm looking for.

If I was using VB I would use a FileList and do something like:



For i = 0 To File1.ListCount - 1


Shell "myexe " & File1.List(i)

Next i



I want to to the same sort of thing using a batch file

Mark Sreeves
Jul 4th, 2000, 08:09 AM
I don't suppose anyone is remotely interested but I just solved this for myself.

This might be NT only though.

This will "type" all .txt files inn the directory:

on the command line:
for %f in (*.txt) do type %f

or in a batch file:
for %%f in (*.txt) do type %%f

catocom
Jul 4th, 2000, 07:58 PM
Sorry I wasn't more help.

A question was asked in General forum about
delaying windows. This could hold the key for
them too.(If used in autoexec)