Friday, March 14, 2008

Detect application launched from command window

recently one in experts -exchange asked me how to detect application launched from command window.

 


   1: static void Main(string[] args)
   2: {
   3:     foreach (string arg in args)
   4:     {
   5:  
   6:         MessageBox.Show(arg);
   7:  
   8:     }
   9:  
  10:     Application.EnableVisualStyles();
  11:     Application.SetCompatibleTextRenderingDefault(false);
  12:     Application.Run(new Form1());
  13:  
  14:  
  15:    
  16: }

 


image


pass the parameters from the command window..this feature can be used to load the program based on various environment settings

No comments: