C# program to demonstrate the use of GetCommandLineArgs() method of Environment class

C# program to demonstrate the use of GetCommandLineArgs() method of Environment class We are going to know more about this very clearly through the article.

C# program to demonstrate the use of GetCommandLineArgs() method of Environment class

C# program to demonstrate the use of GetCommandLineArgs() method of Environment class

using System;

class Sample
{
    //Entry point of Program
    static public void Main()
    {
        string[] cmdArg;

        cmdArg = Environment.GetCommandLineArgs();

        Console.WriteLine("Command Line Arguments:");
        foreach (string arg in cmdArg)
        {
            Console.WriteLine("\t"+arg);
        }
    }
}
D:\>Program.exe 123 ABCD
Command Line Arguments:
        Program.exe
        123
        ABCD

Final Words

C# program to demonstrate the use of GetCommandLineArgs() method of Environment class We hope you find this article very useful. And if you liked this article, we ask you to share it with your friends and help them too.

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Deekshi. Here, I post about programming to help developers.

Share on:

Leave a Comment