How to make batch file execute an executable without having to wait for that executable to finish

How to make batch file execute an executable without having to wait for that executable to finish so that the batch can continue to run other commands while the first executable is still running?

I am trying to run an instance of Matlab executable using "matlab -r gui &", and I would like to close the Windows command prompt that the batch file is running on after executing a Matlab script, but the command prompt won't close.
VWrestle97Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Steve KnightConnect With a Mentor IT ConsultancyCommented:
actually I think that needs to be

START "Window Title" "matlab" -r gui

without the last set of quotes

Steve
0
 
adolphus850Connect With a Mentor Commented:
Call the command with /k switch

e.g.

cmd.exe /k runme.exe

Adol
0
 
1peterxConnect With a Mentor Commented:
Have you tried using the START command in your batch file? That should start the exe in a separate window...
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
Farhan KaziConnect With a Mentor Systems EngineerCommented:
In batch file run executable with start command.

Syntax:
Start <title> <executable.exe>

Like:
Start "" "C:\Program Files\Microsoft Office\Office\WINWORD.EXE"

Hope this helps!
Farhan
0
 
VWrestle97Author Commented:
My original batch file looked like this
cd \
cd Diagnostics\Code_n_Keys
matlab -r gui &
exit

With your changes to my batch looks like this:
cd \
cd Diagnostics\Code_n_Keys
Start "" "matlab -r gui"
exit

And it now gives me the error:
"Windows cannot find 'matlab -r gui'.  Make sure you tayed the name correctly, and then try again, to Search for a file, click the Start button, and the click Search"

I also tried the /k but it still does not close the command prompt after running my Matlab m file
0
 
ccbuilderConnect With a Mentor Commented:
try Start "" "matlab" "-r gui"
0
 
VWrestle97Author Commented:
Got it ...

actually it worked with
Start "" "matlab" -r gui

Thanks
0
 
Steve KnightIT ConsultancyCommented:
Yes it will, I tend to to add a comment because otherwise it can cause confuion. You can in your case actually use just

Start matlab -r gui
but if you have to put " around the filename perhaps because of a space in the name then the following

START "matlab" -r gui

actually puts the title to "matlab" and trys to run -r gui...

so I always put START "Something obviosuly a window title" "theprogname.exe" etc.

Steve
0
 
VWrestle97Author Commented:
dragon-it,

Actually, you are right!
Start matlab -r gui
does work too.

Great follow-up and thanks for the clarification.

Thanks.
0
All Courses

From novice to tech pro — start learning today.