Starting multiple applications from a batch file - how?

Faction

Proto-col
I've got two programmable buttons on my laptop that I'd like to make use of. I can programme them to run... er... programs or batch files, but I can't find a way of making them open more than one application; when I create a batch file containing more than one application name it only starts the next app when the previous one closes. How can I program a batch files to start several programs simultaneously, or is there another way of doing what I want to do?

Thanks!
 

moonbeam1

Hard as Nails !
um well I dont know the answer to your question, but I can tell you why its not working.

When you run an executable from a script the terminal is creating a process for your shell script ( batch file) to run in, as this then launches the app, the app will be in the same process space as the script, which will be de-scheduled from the OS when it sees a context switch( to your application), and then recheduled when that process is killed( when the app terminates).

To get them to run concurrently you need to fork the application into a new process so the script file process is still on the run-queue, and so can carry on and execute the second app. The unix cmd fork(*process addr*) does this in linux, but not sure about windows shell :Sad:

Sorry its a bit of a techie answer, but thats why :Smile3:
 

JPsychodelicacy

Studio Elf
Goodbye my shell, it's hard to "vi",
I cannot socket(), even though I try,
Everything keeps going wrong...
It needs a bind() to carry on,
Proc' table's been full for too long.

Chorus:
We had Joy, We had fun,
We were fork()ing on a Sun,
but the joy is all gone,
'til the processes are Done [1].

Goz is the DOS guru, as far as I know... I've got a horrible feeling that Windows Command Shell is single-task though. :/

J.
 

Faction

Proto-col
Thanks Whitedog, but it looks like Winbatcher waits for one program to terminate before starting the next. I don't think it's what I'm looking for.
 

Poncho

mago del señor
Colin there is a way of doing it so a batch file automaticall runs the next command after a set interval instead of waiting for the terminate signal from the previous program, i'll get back to you if i can find my big bad book of DOS
 

whitedog

Lunar SeeD
Colin OOOD said:
Thanks Whitedog, but it looks like Winbatcher waits for one program to terminate before starting the next. I don't think it's what I'm looking for.
Aaaahh, soorry about that, could have sworn itd do what you wanted... :Sad:

There are numerous macro record/playback apps out there, that should do the trick, though...
Have a look at: http://www.sharewarejunkies.com/windows_macro.htm
(Macro Mania is quite good, i'm told)
 

Warwick Bassmonkey

Average Sized Member
Colin, did you fix this yet?

Dunno how dirty this is, but you could to it with a VBScript. For example, create a new file called "multi.vbs" and stick these lines in it:

Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run("C:\Progra~1\Winamp\winamp.exe")
WshShell.Run("C:\Corel\Draw70\programs\photopnt.exe")

When you run it, it'll fire up both apps. By default, this doesn't wait for one app to close before proceeding with the rest of the script.
Also (and you can check this in Task Manager), the only extra processes running when the script is finished are the ones you fired up.

You might not have the actual apps in my example, but I used those to illustrate the fact that you have to use the old 8 character folder names - "Program Files" doesn't work, you gotta use "progra~1". To find out the short names, just use dir /x in a cmd window.

BTW, if you've got Norton AV running, it might complain the first time you run a VBS. You can just authorise the script and it'll not complain in the future, unless you edit the file.

</nerd>

You can tell I was bored this morning.
 

Warwick Bassmonkey

Average Sized Member
Probably doesn't matter, but I guess if you want to be really tidy ('cos we know Windows isn't), you ought to stick this line at the end of the script:

Set WshShell = Nothing

I'm just learning this stuff, you know.
 
Top