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??
To simply exit the batch file let it run to the end, use exit /b or goto :eof .
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.
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.
CTRL+C will send a break (stop execution) when no text is selected.
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
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