Results 1 to 7 of 7

Thread: Batch file Question

  1. #1

    Thread Starter
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    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?



    Mark
    -------------------

  2. #2
    Member
    Join Date
    Jun 2000
    Location
    Gainesville, Ga
    Posts
    50

    Question in what

    Are you programming in VB , QB or
    something else?
    Scott Cato
    VB6s

  3. #3

    Thread Starter
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    DOS batch file!
    Mark
    -------------------

  4. #4
    Member
    Join Date
    Jun 2000
    Location
    Gainesville, Ga
    Posts
    50

    Cool hello loop

    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]
    Scott Cato
    VB6s

  5. #5

    Thread Starter
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    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:

    Code:
    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
    -------------------

  6. #6

    Thread Starter
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845

    Got it!

    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
    Mark
    -------------------

  7. #7
    Member
    Join Date
    Jun 2000
    Location
    Gainesville, Ga
    Posts
    50

    Lightbulb It interest me

    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)
    Scott Cato
    VB6s

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width