GUI/command line app needs enter to go back to C:>

I have this GUI app that if its initialise with paramters it doesn’t show a GUI and runs on command line.

so I have something like

void initialise(const juce::String & commandLine) override
{
    if (commandLine.isNotEmpty()) //exec command line app
    {
        doSomething();
        quit();
    }
    else
    {
       mMainWindow.reset(new MainWindow(getApplicationName()));
     }
}

if I execute the app from the console with parameters I see:

c:>myApp.exe par1 par2
doSomething with par1
doSomething with par2

<— HERE the app has finished but I don’t see c:>
I have to press enter and then I’m back in c:>

Any ideas of how to make it go straight into c:> ready for some action?

If I create a Console app from projucer and execute it from the command line it goes back to C:> without the need of pressing enter.

Thanks!

looks silly but specially if you run it in silent mode (one of the parameters) you don’t know when the app has finished doing it’s things… and even if you see the output it seems that it hasn’t finished as it doesn’t show c:>

I found a way of sending a “enter” after it shuts down, it does the trick but I wonder if there is a more elegant solution

// ENTER key down
keybd_event(VK_RETURN, 0x9C, 0, 0);
// ENTER key up
keybd_event(VK_RETURN, 0x9C, KEYEVENTF_KEYUP, 0);