I’m starting a Windows Forms application from the command promt and I need to get the exit codes that the windows forms application generates. The command promt starts the application and returns immediatly. But the application executes in the background. Is there a way to get the Exit codes?
Kind Regards
Christian.
The answer is
and then
to extract the return value.
—
And because I like writing batch files… (it’s a problem of mine…)
Save it somewhere with a .bat extension. Run it with the command line of the program you want to run as it’s arguments. It will run the command you gave it, wait for it to end, and then print the return value.
You could also hard code the program by replacing the start /wait line with your app, because as the docs (start /?) say:
CMD will wait for a winform if it is called from a script whether or not Command Extensions are enabled.