in

DavidJBerman.com

An online community of advocacy and support of entrepreneurial ventures

C sharp (C#)

How to access command line arguments

In a C# Windows Application or Console Application, you may want to access arguments passed to your application via the Command Line.

 This is actually very easy to do.  All you have to do is modify your Main() method to take in an array of strings:

 static void Main(string[] args) {
   foreach(string arg in args)
   {
       Console.WriteLine(String.Format("Arg: {0}", arg);
   }
  }
Published Aug 06 2007, 03:32 PM by Dave
Filed under:

Comments

No Comments

Leave a Comment

(required)  
(optional)
(required)  
Add

About Dave

David Berman is an Entrepreneur and Business Systems Analyst Consultant. Through leadership, business process reengineering and strategic planning David transforms companies, enabling them to become more profitable, respond faster to changes in any industry, and become more competitive. David also manages inhouse or internationally outsourced software development projects when custom solutions are needed.
Copyright 2009 David J. Berman, all rights reserved.
Powered by Community Server (Non-Commercial Edition), by Telligent Systems