# calling multiple sessions of an exe with a paramater file feed also



## signalMTB (Jan 14, 2012)

I am trying to kickoff multiple sessions of a program called SaTScan.This SaTScan program has an exe file which can be called from the DOS prompt, and you then feed it a .prm file and it runs off of that. So in simple DOS terms, it would look something like:

"cd c:\Program Files\SaTScan"
"SaTScanBatch.exe C:\temp\parameter_file_1.prm"



How can I write a .bat file so that I can kick off multiple sessions of the program at one time, such that I can run many parameter files at once across separate CMDs rather than running it one by one. For example:

 "cd c:\Program Files\SaTScan"
"SaTScanBatch.exe C:\temp\parameter_file_1.prm"

"cd c:\Program Files\SaTScan"
"SaTScanBatch.exe C:\temp\parameter_file_2.prm"

"cd c:\Program Files\SaTScan"
"SaTScanBatch.exe C:\temp\parameter_file_3.prm"

"cd c:\Program Files\SaTScan"
"SaTScanBatch.exe C:\temp\parameter_file_4.prm"
etc.


----------



## Squashman (Apr 4, 2003)

You do realize that you don't have to keep using the CD command.
Use the START commad to launch each instance of the program.


----------



## signalMTB (Jan 14, 2012)

I tried this, but it only brings up the CMD window and it is at the correct directory. but it doesnt launch the exe

@echo off
cmd /k "cd c:\Program Files\SaTScan"
start "" "SaTScanBatch.exe" 
cmd /k "C:\temp\params998.prm"


----------



## Squashman (Apr 4, 2003)

Not sure what possessed you to try it that way. That code makes absolutely no logical sense.
Assuming your executable can take the input file as input when it is launched you can try this.

```
@echo off
Start "" "C:\Program Files\SaTScan\SaTScanBatch.exe" "C:\temp\params998.prm"
```


----------



## signalMTB (Jan 14, 2012)

Squashman said:


> Not sure what possessed you to try it that way. That code makes absolutely no logical sense.
> Assuming your executable can take the input file as input when it is launched you can try this.
> 
> ```
> ...


sweet, that worked perfectly. thanks!!


----------



## signalMTB (Jan 14, 2012)

Squashman, on the other DOS forum, you mentioned "And if you wanted to, we could create a script where you could drag and drop all your PARM files onto the batch file that you wanted to run. That is how most of my batch files are setup at work."

how would you do this? It is pretty straightforward? Would help because right now I'm running a concatenation within excel and copy & paste everytime I want to run a new set of scripts.


----------



## Squashman (Apr 4, 2003)

```
@echo off
:LOOP
Start "" "C:\Program Files\SaTScan\SaTScanBatch.exe" "%~1"
SHIFT
IF NOT "%~1"=="" GOTO LOOP
```


----------

