Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • 29
    The first element in the array contains the file name of the executing program. If the file name is not available, the first element is equal to String.Empty. The remaining elements contain any additional tokens entered on the command line. Commented Apr 2, 2014 at 7:15
  • @docesam That helped me a lot, thanks! Was wondering why it kept trying to load the program itself as text. Commented Aug 29, 2015 at 5:01
  • 1
    On MSDN: Environment.GetCommandLineArgs Method () Commented Nov 22, 2016 at 15:49
  • After years of C# development i never knew this method existed. Nice. Commented May 25, 2018 at 16:41
  • 1
    is there a benefit to using this method vs sending the parameters main(string[] args)? Commented Jun 14, 2018 at 14:09