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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

adolphus850Commented:
Call the command with /k switch

e.g.

cmd.exe /k runme.exe

Adol
0
1peterxCommented:
Have you tried using the START command in your batch file? That should start the exe in a separate window...
0
Farhan KaziSystems 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
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

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
ccbuilderCommented:
try Start "" "matlab" "-r gui"
0
Steve KnightIT ConsultancyCommented:
actually I think that needs to be

START "Window Title" "matlab" -r gui

without the last set of quotes

Steve
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming Languages-Other

From novice to tech pro — start learning today.