Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

get the parameters entered when the program is runed from thecommand line?

I am a beginner in C# and I recently wanted to develop a program that starts from the command line with some parameters.

Suppose I have a console program now
I run it from the command line and provide some parameters ,I need to get -d "D:\output\"

C:\Program Files\myprogram.exe -d "D:\output\"

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

static class Program
{
    static void Main(string[] args)
    {
        // your code here; 'args' has the command line arguments
        // i.e. args will be length 2, args[0]==="-d", etc
       
    }
}
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading