[windows2000] Re: Batch File Question

  • From: "Braebaum, Neil" <Neil.Braebaum@xxxxxxxxxxxxxxxxx>
  • To: <windows2000@xxxxxxxxxxxxx>
  • Date: Mon, 22 Sep 2003 09:48:02 +0100

> Date: Sat, 20 Sep 2003 14:40:37 -0700
> From: Mike Dillinger <miked@xxxxxxxxxxxxxx>
> Subject: [windows2000] Batch File Question
> Hello,
> Here's my situation.  I know it's a little funky, but I have 
> reasons for doing it.
> What I want to do is have a login BAT file run for a user.  I 
> want to specify a list of programs to run upon login.  Here's 
> functionally what I want to do (link to batch file is in the 
> Startup folder):
> - User login
> - Run program A
> - Run program B
> - Run program C
> I know there's the startup folder, but I'd like to run these 
> in a certain order.  One has to be loaded before the other, 
> and I have to pause/sleep for a bit between A, B, and C.
> I have a batch file I wrote, but I'm doing one or both of these things
> wrong:
> - Make an array or variable list in Windows batch scripting
> - Get the "for" loop to process
> Here's pretty much what I got now (exact paths/filenames 
> changed to protect the innocent):
> -----
> @echo off
> :: Variable definition
> set ProgramA="C:\Program Files\proga.exe"
> set ProgramB="C:\Program Files\progb.exe"
> set ProgramC="C:\Program Files\progc.exe"
> set ProgramsToRun=%ProgramA%;%ProgramB%;%ProgramC%
> set Sleep="C:\Program Files\sleep.exe"
> :: Run each program with a 30 second delay in between
> for /f "delims=;" %%i in ( %ProgramsToRun% ) do (
>    :: echo %%i
>    %Sleep% 30
>    START "" %%i
> )
> -----
> Any help is greatly appreciated.  Thanks!

In this instance - why have the for loop?

I could understand an array (or even building one) if the programs to
run, were variable, and passed as arguments, or read from a file - but
if they're merely statically hard-coded in the bat or cmd file, why not
just have them merely as start instructions with a sleep in between

I'm struggling to understand why you are making it more complex than it
apparently needs to be?


This e-mail and its attachments are confidential
and are intended for the above named recipient
only. If this has come to you in error, please 
notify the sender immediately and delete this 
e-mail from your system.
You must take no action based on this, nor must 
you copy or disclose it or any part of its contents 
to any person or organisation.
Statements and opinions contained in this email may 
not necessarily represent those of Littlewoods.
Please note that e-mail communications may be monitored.
The registered office of Littlewoods Limited and its
subsidiaries is 100 Old Hall Street, Liverpool, L70 1AB.
Registered number of Littlewoods Limited is 262152.

To Unsubscribe, set digest or vacation
mode or view archives use the below link.


Other related posts: