Alright so I have a program called WC_Error_Resolution, which was written in C# (C# Console Application with .NET 4.0). This program returns 0, 1, or 2 depending on what is done while running the program. If I call it from cmd.exe, everything works fine. However, here is where I get confused. I have a test batch script (the real one is much larger) that calls it like:
ECHO Start
WC_Error_Resolution.exe file1.xml file2.xml inifile.ini log1.log log2.log
ECHO ERRORLEVEL=%ERRORLEVEL%
The problem here is that the second echo never gets executed. The second the script gets to the program, it calls it and exits the batch script. Then I decided to try:
ECHO Start
START /B /WAIT "" WC_Error_Resolution.exe file1.xml file2.xml inifile.ini log1.log log2.log
ECHO ERRORLEVEL=%ERRORLEVEL%
This time, it works as expected. I have created tons of batch scripts that call .exe files like the first example, and have never run into a problem like this. What could cause the script to stop execution after the WC_Error_Resolution.exe program returns?
EDIT
-----------------------------------------------------
So now this is showing up with another program of mine. Both programs reference System.Xml.Linq
. The programs can be scripted on Windows 7, Windows 8, & Windows Server 2012 R2. The programs fail to execute on Windows Server 2008 R2 and do not show any error. The script simply never executes the program or commands below the program call. A quick note, this is a 32-bit program being run in a 64-bit environment with WoW64 enabled. Is there some issue with .NET applications run on Windows Server 2008 R2 that I don't know about?