create a bat file to run 3 programs in order

122 Views Asked by At

Hello i have 3 programs that i run every day one by one i would like to create a bat file the run this 3 exe file but i can't make it work.

here my file:

@ECHO OFF

echo "start audio"

start "C:\Users\damia\Desktop\A320\ProSimA322-Audio2\ProsimAudio.v2.exe"

timeout /t 5 > nul

start "C:\Users\damia\Desktop\A320\ProSimIOS\ProSimIOS.exe"

timeout /t 5 > nul

start "C:\Users\damia\Desktop\A320\ProSimA322-System\ProSimA322-System.exe"

echo "done"

but nothing start any idea what im doing wrong

2

There are 2 best solutions below

0
zCooki On BEST ANSWER

I have finally understood the one comment on this question meant after typing a whole answer. But I'll keep that answer up anyways and have this as a separate one.

Considering it wasn't immediately clear to me what was meant, I'll add one of the three lines of code:

BEFORE (original not working code)

start "C:\Users\damia\Desktop\A320\ProSimA322-Audio2\ProsimAudio.v2.exe"

AFTER (new working code)

start "" "C:\Users\damia\Desktop\A320\ProSimA322-Audio2\ProsimAudio.v2.exe"

Make sure to add the "" after the start to all three start commands, not just the one.

0
zCooki On

The "" markings are considered a switch for the title of a new cmd window.** All that your code starts is three new cmd windows, with the titles of the file paths you're trying to open.

As you do not have spaces in your file path, you can simply get rid of the "", but if you had spaces you would have to do the other method of starting a file which is to just type its name (without the start command before it). This has to be done with "" around it if there are spaces, but it doesn't matter if you have them or not when there are no spaces. Simply typing the file's name is not enough if it's not in the same directory as the current directory of the batch script, so you would need to change the directory using cd. Using a file's name instead of start will run it within the command prompt window if it can be run through it, though. But that's not a thing for most executable files.

I gave some unnecessary information above, but it may be useful to you anyways.

The code below has a few more things added to it for better ease of use, but you can always go back to your original code. The only change needed to make your code work was to remove the "" in the parameter for the start command.

@echo off
title Start Audio
echo.
echo -Start Audio-
echo.
echo Press any key to begin . . . 
pause >nul
start C:\Users\damia\Desktop\A320\ProSimA322-Audio2\ProsimAudio.v2.exe
echo.
echo Started ProsimAudio.v2.exe
pause
start C:\Users\damia\Desktop\A320\ProSimIOS\ProSimIOS.exe
echo Started ProSimIOS.exe
pause
start C:\Users\damia\Desktop\A320\ProSimA322-System\ProSimA322-System.exe
echo Started ProSimA322-System.exe
echo.
echo Done.
echo Press any key to exit . . . 
pause >nul
exit