I'm trying to run some console application .exe files from a batch file in Windows.
However, when I run the following code it only starts the first of the apps:
"C:\Development\App\bin\Debug1\Application.exe"
timeout 5
"C:\Development\App\bin\Debug2\Application.exe"
timeout 5
"C:\Development\App\bin\Debug3\Application.exe"
timeout 5
"C:\Development\App\bin\Debug4\Application.exe"
timeout 5
"C:\Development\App\bin\Debug5\Application.exe"
timeout 5
(I've included the timeout to spread out the intial processing a bit)
Is there a way to get the script file to start the first application, then move on and start the others?
Ideally I would like the script file to start all applications in a subdirectory, so that if I had Debug\Applications\*.exe
or similar it would start all applications of type .exe (and possibly waiting 5 seconds between each). Is this possible?
You can start applications in the background by using start
:
start "C:\Development\App\bin\Debug1\Application.exe"
Use start /?
from a command window to get further details.
For example,
start dir
will open a new command window and show you a directory listing, leaving it open when finsished.
The:
start cmd /c "ping 127.0.0.1 && exit"
command will open a new window, run a four-cycle ping on localhost then exit.
In both cases, the current window will await the next command immediately.
@echo off
for %%F in ("Debug\Applications\*.exe") do (
start "" "%%F"
timeout 5
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With