Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Command line does not wait until the exe execution is finished

I converted my matlab program to a standalone exe. When I call the exe from the command line it does not wait till the exe is executed. The program takes about 20-30sec to run. The program basically creates a txt file. How can I make it to wait until the exe is executed. My matlab main function is

function []=features(img_path,category,output_path)
if (strcmp('shoe',category)== 1)
    if exist(img_path,'file')
     test_shoes(img_path,output_path);            
    else
        disp ('Input image path does not exist');
    end     
else
    disp('Sorry wrong input for category.Please give shoe/dress/handbag');

end
return;

The problem is shown in the below screenshot:

The "All warnings have the state 'off'." is actually displayed by the exe from MATLAB afer 5 sec but the terminal does not wait until the exe is finished executing i.e "E:\test>" is already shown in the next line immediately after calling the exe.

How can I make the commandline wait until the exe os finished executing so that the new command line does not appear until its finished??

like image 447
user1583647 Avatar asked Aug 29 '13 10:08

user1583647


People also ask

How do you wait for an EXE to complete in batch file?

To simply exit the batch file let it run to the end, use exit /b or goto :eof .

How do I wait for a command prompt script?

You can use timeout command to wait for command prompt or batch script for the specified amount of time. The time is defined in Seconds. The above commands will break the timeout process on pressing any key. You can use /NOBREAK ignore key presses and wait for the specified time.

How do I stop command prompt from closing after running EXE?

If you want the command prompt cmd widnow to stay open after executing the last command in batch file –you should write cmd /k command at the end of your batch file. This command will prevent the command prompt window from closing and you'll get the prompt back for giving more commands in the cmd window.

How do you stop the execution of the chain of command?

CTRL+C will send a break (stop execution) when no text is selected.


1 Answers

You could try to run it like this:

START /WAIT MyProgramm.exe

take a look here:

how-do-you-wait-for-an-exe-to-complete-in-batch-file

like image 112
Lucius II. Avatar answered Sep 30 '22 07:09

Lucius II.