Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: W.2K batch scripting help please.  (Read 2363 times)

0 Members and 1 Guest are viewing this topic.

AlfredO

  • Guest
W.2K batch scripting help please.
« on: February 23, 2008, 08:15:08 PM »
I want to execute multiple programs in sequence.  The programs are stored in a directory named D:\Progfils.  I also want to ensure that a second and subsequent program is not started before the previous one has ended.  Can this be done?

My code so far:
Code: [Select]
@echo off
cls

: Set variable for Progfils directory
Set progfils=d:\Progfils\

: Create program file names list in alpha sequence..
Dir /on/b %progfils% > d:\temp\filename.txt

: Start program sequence..
FOR /F %%a in (d:\temp\filename.txt) do start %progfils%\a%%

At this point I need some coding to ensure that the second and subsequent program does not start before the previous one has completed.  Please indicate what command will achieve this.

Thanks.

macdad-



    Expert

    Thanked: 40
    Re: W.2K batch scripting help please.
    « Reply #1 on: February 23, 2008, 09:19:32 PM »
    in a sequence like such in such file 1st and so in so file 2nd
    or just all of the programs togther?
    If you dont know DOS, you dont know Windows...

    Thats why Bill Gates created the Windows NT Family.

    AlfredO

    • Guest
    Re: W.2K batch scripting help please.
    « Reply #2 on: February 23, 2008, 09:38:38 PM »
    Sorry, I really don't understand your question.

    The programs are to be run in alpha sequence from A to Z but program B must not be started before program A has finished, program C must not be started before program B has finished etc...  Only one program is to run at any time.
    Thanks

    GuruGary



      Adviser
      Re: W.2K batch scripting help please.
      « Reply #3 on: February 23, 2008, 11:39:39 PM »
      Try adding the /WAIT to your START command.  Like this:
      Code: [Select]
      FOR /F %%a in (d:\temp\filename.txt) do start /WAIT %progfils%\a%%

      AlfredO

      • Guest
      Re: W.2K batch scripting help please.
      « Reply #4 on: February 24, 2008, 12:33:28 AM »
      Thank you, that looks like what I need.

      Edit: Yes, worked like the proverbial charm, thanks again.

      Alf.
      « Last Edit: February 24, 2008, 04:49:48 PM by AlfredO »