How to get Environment.ExitCode value from the Command line
I have a Winform application which can be run in GUI mode as well as in command prompt.
In the command prompt, I basically call appropriate button depending upon the given command line argument. For example: "C:/> MyTool param1" will call Button1_ClickEventHanlder() internally
In this Button1_ClickEventHandler() method, I set Environment.ExitCode to some value depending upon some conditions.
My question is how to get Environment.ExitCode value from the Command line in a winform app?
I tried echo %errorcode% after running my app from command prompt but no luck, it's always giving 0. Even I tried "start /wait MyTool param1" too but it's not giving proper ExitCode value what it's supposed to give as per code logic.
Please help me to resolve this issue.