I have a console application in which I need to detect whether or not it was executed from a command line, as opposed to from within a batch file. I want to protect
Console.Write ( "Press any key to exit" );
Console.ReadKey ( true );
Console.WriteLine ( );
from executing when the app is executing from within a batch file.