I would like to place a batch file on my desktop that will execute two .exe files in succession. Files are both in the same folder. Would someone be kind enough to give me a batch file that will do this in Win 7?
dude, you need to know what folder that you want to execute the 2 programs. Here is a breakdown of it though. Lets say they are in just the C:\ Root, here are some commands that would get you going: "C:\1.exe" = First EXE "C:\2.exe" = Second EXE That is basically how it is done but you have to change the directory and file name accordingly.
Thanks, I knew that much. I just didn't know if there was anything I had to put in to actually "Run" the .exe files. I assume I also have to add an "End" to terminate the batch, right?
you can actually end the programs withing the same batch script. It is Taskkill /IM "XXX.exe" the "X" stands for the name of the exe and if you have the batch file inside the same location where the exe's are then you only have to have something like this. Code: cd %0\..\ start 1.exe start 2.exe taskkill 1.exe taskkill 2.exe Basically without having to have the location directory in the script. You must have the "cd %0\..\" in it at the top though for it to work right dude.
I guess I should have just given the files I wanted to run in the first place 'cause what I'm doing ain't working! Here goes: C:\Program Files\Timbuktu Pro\tb2start.exe and C:\Program Files\Timbuktu Pro\tb2pro.exe are the two files I need to run consecutively with a batch file. Don't ask me why both have to run to start the program: I don't know! For some reason the last file will not start the program without the first running. If you can help me sam3971, I'd really appreciate it.
Ok then this is how you do it: Method 1: IF you want to call the files from outside the Timbuktu Pro folder: Code: "C:\Program Files\Timbuktu Pro\tb2start.exe" "C:\Program Files\Timbuktu Pro\tb2pro.exe" Method 2 Inside the Tumbuktu Pro folder: Code: cd %0\..\ start tb2start.exe start tb2pro.exe
OK, that got it! I was missing the (")'s around the command lines. Do you have any idea how to get the "cmd.exe" box that opens with the program to close? I can just click on the "X" at the top right corner, or it will close when I shut the program down, but I'd like to add something to the batch file that will close it automatically after the program starts. I've tried adding "EXIT" and :END to the batch file, but neither worked. Thanks again for all your help. Folks in this forum (timesurfer notwithstanding) are really great!
yea you type "Exit" in the bottom of the script so like lets say you use method 2, it would look like this: Code: cd %0\..\ start tb2start.exe start tb2pro.exe exit
"Exit" (in quotes) will work, but only if the program is already running in the Start Bar. Batch will then open the control console and close the cmd window, but not if it's shut down completely. Not a big deal as the window can be closed manually; just wanted to try closing it with the batch. Many thanks for all your help.
dude, exit will close CMD down without the other programs. Isn't that what you want? Don't actually put the "" in it on the script.
sigh it seems batch files are becomeing a lost art anyway here is the proper way copy and paste in between the line ----------------------------------------------- @echo off cd C:\Program Files\Timbuktu Pro start tb2start.exe start tb2pro.exe @ping 127.0.0.1 -n 2 -w 5000 > nul taskill /IM cmd.exe ---------------------------------------------------------
try using this: "C:\Program Files\Timbuktu Pro\tb2start.exe" "C:\Program Files\Timbuktu Pro\tb2pro.exe" pause.
Has been awhile since coming here saw this thread and thought maybe a chance to help. I had a similar task I wanted to do in a batch file and this helped..... @echo off cls Start /w start your batch like this add the file path and the exe and any switches this will run the first program and when its finished it will start the second as long as start /w is in front of it. this works in vista and windows 7