Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invoke EXE from batch file *without* waiting

Tags:

batch-file

How do I invoke an EXE from a batch file without having the latter waiting for the EXE to finish? Something like the Cygwin 'cygstart'?

like image 822
Jeenu Avatar asked Oct 30 '09 05:10

Jeenu


People also ask

How do I run an exe from a batch script?

Create Batch File to Run EXESave your file with the file extension . bat , e.g. run-exe-program. bat and double click on it to run the .exe program.

What is @echo off in batch?

batch-file Echo @Echo off @echo off prevents the prompt and contents of the batch file from being displayed, so that only the output is visible. The @ makes the output of the echo off command hidden as well.

How do you tell batch file to wait?

TIMEOUT — Type timeout time where "time" is replaced by the number of seconds to delay. For example, typing in timeout 30 will delay your batch file for 30 seconds. If you want to prevent people from skipping the delay with a keypress, type in timeout time /nobreak (where "time" is the number of seconds to wait).

How to wait for a program to finish in a batch?

When we start a program in a Batch file using the START command, we can wait until the program is finished by adding /wait to the START command. Even if there are multiple commands, /wait can be used for each process to finish and move to the next one. Also, the parameter /B is used to stay in the same process without creating a new window.

What happens when you call an exe from a batch file?

If the exe you call then creates other process, such as calling another exe, and then exits the batch file will continue processing after the called exe has terminated, as it has no knowledge of other processes started by it.

How do I start a process from a batch file?

Either calling the exe directly from the batch file, or using start /wait will work but there is a caveat. If the exe you call then creates other process, such as calling another exe, and then exits the batch file will continue processing after the called exe has terminated, as it has no knowledge of other processes started by it.

Can I run a program from a batch file?

In Windows you can run any program with the .exe extention from a batch file that is very useful in different automation scenarios. For example, you may want to create a batch file to use it as a launcher for the program that you want to execute with some parameters.


2 Answers

Use "start". Type "start /?" at a command prompt.

like image 143
janm Avatar answered Sep 18 '22 01:09

janm


put START /B before the command you want to run

like image 39
Andrew Keith Avatar answered Sep 22 '22 01:09

Andrew Keith