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

Time:04-19

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\"

CodePudding user response:

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
       
    }
}
  • Related