# Batch File to Open Multiple Programs



## davisa30 (Jul 13, 2006)

Hello - newbie here. I use Windows XP mostly at work. I have to open about 10+ programs every day when I log onto our network. I'd like to create a some type of batch file that would quickly open all the various programs I need. It takes me few minutes to get everything open and it's particularly annoying when something goes wrong and I have to start all over again. 

I must say I don't know about creating batch files so I need very basic and specific help. I'm not even sure if it's possible or not to make such a batch file. All the programs I use have desktop icons.

Any help would be appreciated. If I'm in the wrong area, let me know 

Andy D


----------



## colmaca (Jul 12, 2003)

davisa30 said:


> . All the programs I use have desktop icons.
> 
> Andy D


welcome, I don't see why you would need a batch file why not put them in the start up folder.
open

C:\Documents and Settings\"your user name"\Start Menu\Programs\Startup
drag the icons into that folder and they should auto run when you log in


----------



## davisa30 (Jul 13, 2006)

I tried to do what you said but when I drag it over I get a message that says "ERROR MOVING FILE OR FOLDER - Cannot move xxxxx: access is denied". I guess that is thanks to our unhelpful IS Dept.

Andy


----------



## colmaca (Jul 12, 2003)

The ones you get a error for try right click create shortcut, then drag the shortcut into the startup folder.


----------



## ChuckE (Aug 30, 2004)

Correct, you should just put shortcut icons into your Startup folder, not the actual program or file.

The reason you don't want to put a program file on the Startup folder is that some programs may require other auxiliary files; and your either moving the program file into the Startup, or copying the program file there, does not get those other files there.

You avoid that by just putting the shortcut icon into Startup. The program is still where it belongs, with easy access to those other files, if needed.


----------



## byabba (Sep 20, 2003)

you might like to try Batchrun, it's freeware and quite handy...
" http://www.outertech.com/index.php?_charisma_page=product&id=1"


----------



## davisa30 (Jul 13, 2006)

Thanks for the help everyone. I tried dragging the shortcut to the Start file and it works great. One thing though, I need several copies of the same program open. I tried dragging multiple shortcuts but only one opens with error messages on the others. I tried changing the name a little and that didn't help either. Any ideas how to get more than one copy of the same program to open from the start file?

Thanks,

Andy


----------



## colmaca (Jul 12, 2003)

A idea off what program might be nice as some programs won't allow multi runnings .


----------



## davisa30 (Jul 13, 2006)

The program I need mutiple copies of is our in house customer service system. It runs from our Sun mainframe. The program is not canned software, but was developed by our programming dept. I always run multiple copies (at least 3 or 4) at all times


----------



## colmaca (Jul 12, 2003)

I take it you can open it once and then need to open multi windows the same program?
I would be looking at a "macro" program to do the opening for you. or you will need to do some hand movement to open things


----------



## davisa30 (Jul 13, 2006)

OK, then. I don't know what you mean about a macro program but I'll enjoy what you've help me accomplish and open the other copies manually. Thanks


----------



## colmaca (Jul 12, 2003)

you will get a general Idea what a macro is with google here http://www.google.com.au/search?hl=en&q=macro+programs&btnG=Search&meta=

basically it will do the clicking for you once you set it up to record a event and it will do what is recorded.


----------



## ChuckE (Aug 30, 2004)

Since you already know that your program allows multiple instances, of it, open at the same time, then there ought to be a way of getting those multiple instances open using just the shortcut icons in your Startup folder.

However, just having slightly renamed icons to the exact same program file is probably not going to work, as you have already found out. The reason is that the "Target" line (which is really a command line) of the shortcut icon is still identical in each shortcut icon there.
For example, if you open the Properties of one of those shortcut icons, and select the "Shortcut" tab, you may see something like this:
"C:\Program Files\SomeCompany\In House System\OurService.exe"

You may need to ask someone, in your company, as to what parameters are needed to follow that command line to open up a single directed instance, and then include that, slightly altered, for each Shortcut icon in your Startup folder.

For example, suppose the command line needs to have a file named after it, then the Target line might look like this:
"C:\Program Files\SomeCompany\In House System\OurService.exe" doc1.svc
and another instance, for the second shortcut icon then might be:
"C:\Program Files\SomeCompany\In House System\OurService.exe" doc2.svc
and another might be:
"C:\Program Files\SomeCompany\In House System\OurService.exe" doc3.svc
etc.

Or, (again after verifying with the developers of your in-house service software), it might require a "switch" (which usually is preceded with a slash "/") after the command, such as:
"C:\Program Files\SomeCompany\In House System\OurService.exe" /newwindow
and subsequent Shortcut Target lines might use that exact same Target (command) line.

OR! perhaps it might be a combination of both, like:
"C:\Program Files\SomeCompany\In House System\OurService.exe" /newwindow doc1
then
"C:\Program Files\SomeCompany\In House System\OurService.exe" /newwindow doc2

Check with the developers of your software. I'll bet it can be done.


----------



## JohnWill (Oct 19, 2002)

You can also use the START batch command, it has lots of options for starting multiple applications.

C:\START /?

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

START ["title"] [/Dpath] [/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 application
enables ^C processing, ^Break is the only way to interrupt
the application
I The new environment will be the original environment passed
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
ABOVENORMAL Start application in the ABOVENORMAL priority class
BELOWNORMAL Start application in the BELOWNORMAL priority class
WAIT Start application and wait for it to terminate
command/program
If it is an internal cmd command or a batch file then
the command processor is run with the /K switch to cmd.exe.
This means that the window will remain after the command
has been run.

If it is not an internal cmd command or batch file then
it is a program and will run as either a windowed application
or a console application.

parameters These are the parameters passed to the command/program

If Command Extensions are enabled, external command invocation
through the command line or the START command changes as follows:

non-executable files may be invoked through their file association just
by typing the name of the file as a command. (e.g. WORD.DOC would
launch the application associated with the .DOC file extension).
See the ASSOC and FTYPE commands for how to create these
associations from within a command script.

When executing an application that is a 32-bit GUI application, CMD.EXE
does not wait for the application to terminate before returning to
the command prompt. This new behavior does NOT occur if executing
within a command script.

When executing a command line whose first token is the string "CMD "
without an extension or path qualifier, then "CMD" is replaced with
the value of the COMSPEC variable. This prevents picking up CMD.EXE
from the current directory.

When executing a command line whose first token does NOT contain an
extension, then CMD.EXE uses the value of the PATHEXT
environment variable to determine which extensions to look for
and in what order. The default value for the PATHEXT variable
is:

.COM;.EXE;.BAT;.CMD

Notice the syntax is the same as the PATH variable, with
semicolons separating the different elements.

When searching for an executable, if there is no match on any extension,
then looks to see if the name matches a directory name. If it does, the
START command launches the Explorer on that path. If done from the
command line, it is the equivalent to doing a CD /D to that path.


----------



## ChuckE (Aug 30, 2004)

Note: Since multiple shortcut icons in your Startup folder does not get multiple instances of your program going, then using the batch command will probably still not get multiple instances of your program going, UNLESS you know of the syntax of how to do so. Which is what I wrote earlier.

Once you do know the correct syntax, then either
the multiple shortcut icons in your Startup folder OR 
the batch file, as *JohnWill* suggests, will work.

But to create the batch file will require you to create the batch file and still place it somewhere in the startup process, where your PC will use it. Which could be as simple as just placing the batch file - or a shortcut to the batch file, in your Startup folder; or using some startup tool/software that will effectively handle that for you.

For simplicity, and not needing to understand batch files (which I do, but you may not), I'd just place the individual shortcut icons in the Startup folder.


----------



## JohnWill (Oct 19, 2002)

The start command has a lot more flexibility, and you can define the start order for the various copies. However, as you say, it is more complicated to initially setup.


----------



## ChuckE (Aug 30, 2004)

Ahhhh! but *davisa30* is still going to have to know the particular command line, and parameters, to get separate instances running. Otherwise, just multiple commands will not open multiple windows. And that is all I was hoping he'd understand, and investigate.

I was not trying to diminish your useful info.


----------



## JohnWill (Oct 19, 2002)

That's why I posted the help screen, and not the actual batch file.  After all, remember the old saying...

We operate on the philosophy: _Give a man a fish, and you'll feed him for a day, teach him to fish, and you'll feed him for a lifetime._

Time to go fishing!


----------



## ChuckE (Aug 30, 2004)

oh, I thought it was "... teach him to fish and he'll sit in a boat and drink beer all day."


----------



## JohnWill (Oct 19, 2002)

Grrrrr!


----------



## Squashman (Apr 4, 2003)

Open.vbs

```
Dim oShell 
Set oShell = WScript.CreateObject ("WSCript.shell") 
oShell.run "notepad" 
Wscript.Sleep 2000 
oShell.run "notepad" 
Wscript.Sleep 2000 
oShell.run "notepad" 
Set oShell = Nothing
```


----------



## JohnWill (Oct 19, 2002)

Well Sqwashman, we were trying to teach him to fish.


----------



## Squashman (Apr 4, 2003)

JohnWill said:


> Well Sqwashman, we were trying to teach him to fish.


Well he can still figure it out with a Batch File if he wants to.


----------



## calisurf (Jan 26, 2006)

Hi,
I'm running into a similar issue here. Here is the background.
1) I'm trying to run an in house program with a batch file.
2) This same program needs to be open multiple times, running different parameters
3) The program can be run manually multiple times together
4) I can run the batch file cleanly if I open up the program one time
5) When I run 2 programs, they both open up, but I get an error, "error bind()failed"
6) When I run 3 programs, I get the same result, but the 3rd program won't run, so something is getting hung up when I try to run 2.
7) When I try to /WAIT the 2 programs run cleanly, but only after I shut the first one down.
I feel like im almost there.

This is what the batch file looks like


set time=%Date:~-4,4%%Date:~-10,2%%Date:~-7,2%.csv

Start /MIN C:\Windows\"inhouseprogram" -l site1_%time% -a 10.X.X.1 -i 20 -s 10000

Start /MIN C:\Windows\"inhouseprogram" -l site2_%time% -a 10.X.X.2 -i 20 -s 10000


Any suggestions? I feel like there is some command I'm missing in between the first and second start commands. 

thanks in advance.


----------



## ChuckE (Aug 30, 2004)

From what I've Googled, it seems that a "error bind()failed" is related to trying to connect multiple times to the same IP address, or the same server.

I see that you are indicating a different IP address "10.X.X.1" and "10.X.X.2" (and you probably have real numbers in those "X" locations, that you are not telling us here, that's understandable), but perhaps those two different IP addresses are understood, on the server you are connecting to, are known to be the same server.

(By the way, you really should have created a new thread for your issue. This problem may get lost when you try to ride on the tails of the original problem here, in this thread.)


----------



## calisurf (Jan 26, 2006)

thanks for the reply.

i saw that on the search as well.

the ips i have in there are different devices so i'm not sure how they would be mistaken as the same sever, or a duplicate ip.

just for kicks i created a second batch file, for device number 2. and ran both batches separately. They both opened up cleanly for their respective devices and worked simultaneously.

it would be nice to have the batch start everything instead of creating 50+ batches for each individual devices.


----------



## ChuckE (Aug 30, 2004)

How about a single batch file that CALLs the individual, and separate, batch files for the individual devices?

(Just thinking here.)
You could use variables that could ever use the same, outside, batch file that reuses the same batch file multiple times.


----------



## ChuckE (Aug 30, 2004)

Of these "50+ batches" (as you called them) you could make your first batch file make the 50+ batch files, and delete them once not needed anymore.

Clumsy, possibly, but workable.


----------



## calisurf (Jan 26, 2006)

those are good suggestions. many ways to skin a cat.
i think i might use the "call" to see if that'll work. i'm learning as i go. this is my first batch if you couldn't tell.

thanks for the help.


----------



## calisurf (Jan 26, 2006)

i did a call for my second batch and it gave me the same error as before. error bind()

i can run them separately just fine.hmmm.


----------

