What you are asking for cannot be handled in the executable. The console is launching the executable and not waiting for it to exit. That is a console issue, not an executable issue. You need to use the console’s start
command to run the executable so you can use the command’s /wait
parameter:
start /wait myapp.exe /silent
Or else use a batch file to run your executable, and then have the console run the batch file. A batch file waits for each command to complete, and the console waits for a batch file to complete.
solved After Executing a exe from command line command line should wait for the completion of exe