Build Your Own Arcade Controls Forum

Main => Software Forum => Topic started by: Popcorrin on September 27, 2004, 06:18:52 pm

Title: Writing batch files. Need some help
Post by: Popcorrin on September 27, 2004, 06:18:52 pm
I have limited experience writing batch files and I need some advice on how to get one to work like I want it.  

What I want to do is be able to start 2 programs via a batch file and the problem that I am running into is that the 1st program starts fine but the 2nd program won't load until I exit out of the 1st program.
Is there anyway around this?  Thanks
Title: Re:Writing batch files. Need some help
Post by: Druin on September 27, 2004, 06:38:13 pm
That's how batch files work!  Sequential execution of commands just like a person would enter one after another, but automated.
So about the only thing I can think of off hand to do is not use a batch file for the program launching, but make or see if exists, a program that will just let you shell and run other programs, then maybe you can run that, and it will shell to run program 1 and then shell to run program 2, and may do it simultaneously?

I just tried shelling to DOS (Haven't said that in almost  a decade) and running CMD (command.com?) to see if I can open a shell that way and still get back to the prompt while it runs..no good... I was at c:\mame and I typed:
cmd /C mame pacman  
and it ran the game but sat waiting until I quit mame, then it let me issue another command.

So I think you have to find or write a program to launch multiple things.
Title: Re:Writing batch files. Need some help
Post by: DaemonCollector on September 27, 2004, 06:41:58 pm
You won't be able to launch 2 programs simultaniously in a batch file as they are layover from DOS. To run 2 programs at once you need multithreading, and DOS can't do that without some hefty extensions.
Title: Re:Writing batch files. Need some help
Post by: SirPoonga on September 27, 2004, 07:14:05 pm
I thought batch files were async when running external programs from within the batch file..

What are you trying to do?  What two programs?  Why do you need to do this?  There might be a better way...
Title: Re:Writing batch files. Need some help
Post by: creatine28 on September 27, 2004, 07:22:21 pm
I have limited experience writing batch files and I need some advice on how to get one to work like I want it.  

What I want to do is be able to start 2 programs via a batch file and the problem that I am running into is that the 1st program starts fine but the 2nd program won't load until I exit out of the 1st program.
Is there anyway around this?  Thanks

Here's a good page with a bunch of DOS batch files, maybe something here will help?


http://esca.atomki.hu/simtel/msdos/batchutl.html (http://esca.atomki.hu/simtel/msdos/batchutl.html)
Title: Re:Writing batch files. Need some help
Post by: Thenasty on September 27, 2004, 08:52:52 pm
write 2 batch program and shove it in the START folder.  ;D
Title: Re:Writing batch files. Need some help
Post by: Popcorrin on September 27, 2004, 10:23:03 pm
I thought batch files were async when running external programs from within the batch file..

What are you trying to do?  What two programs?  Why do you need to do this?  There might be a better way...

Thanks for all the responses.  I was wanting to use a batch file as shell that would load mamewah and also powerstrip.
Title: Re:Writing batch files. Need some help
Post by: DaemonCollector on September 27, 2004, 10:32:09 pm
maybe a VBScript?
Title: Re:Writing batch files. Need some help
Post by: DougHillman on September 28, 2004, 08:49:08 am
How about sticking Powerstrip in the Local Machine/Software/Microsoft/Windows/Current Version/Run section of the registry?

Title: Re:Writing batch files. Need some help
Post by: Popcorrin on September 28, 2004, 09:28:13 am
How about sticking Powerstrip in the Local Machine/Software/Microsoft/Windows/Current Version/Run section of the registry?



Would it still get loaded even though I'm using mamewah as shell?
Title: Re:Writing batch files. Need some help
Post by: ries on September 28, 2004, 02:40:37 pm
If you want to start seperate programs from batch files do this;


@echo off
start program1.exe
program2.exe


the built in start program will open another window and execute program1.exe.

"help start" in a command windows gives this help screen, you can use it to start programs with different priorities etc.

Starts a separate window to run a specified program or command.

START ["title"] [/D path] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED]
      [/LOW | /NORMAL | /HIGH | /REALTIME | /ABOVENORMAL | /BELOWNORMAL]
      [/WAIT] [/B] [command/program]
      [parameters]

    "title"     Title to display in  window title bar.
    path        Starting directory
    B           Start application without creating a new window. The
                application has ^C handling ignored. Unless the applicatio
                enables ^C processing, ^Break is the only way to interrupt
                the application
    I           The new environment will be the original environment passe
                to the cmd.exe and not the current environment.
    MIN         Start window minimized
    MAX         Start window maximized
    SEPARATE    Start 16-bit Windows program in separate memory space
    SHARED      Start 16-bit Windows program in shared memory space
    LOW         Start application in the IDLE priority class
    NORMAL      Start application in the NORMAL priority class
    HIGH        Start application in the HIGH priority class
    REALTIME    Start application in the REALTIME priority class

remember to spice things up use "title" to set the windows title of the command prompt and a nice "color"  command in the beginning of the batch to set the background and font color of the command prompt window...

Title: Re:Writing batch files. Need some help
Post by: Popcorrin on September 30, 2004, 08:35:08 am
Thanks Ries.  Looks like I should be able to do what I want with the options you gave me.  :)

I was just curious does anyone know if powerstrip would get loaded if I put it in the registry as DougHillman suggested even though I am using mamewah as shell?