Command line arguments

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Hari

    #1

    Command line arguments

    can i have command line arguments in VS.NET applicatio?
    if yes how?
    Can i have some code snippets of the above functionality?

    I know we can acjieve this in console application form
    command prompt but how can i achieve it in an application
    in VS.NET?

    Thank you
  • Jon Skeet [C# MVP]

    #2
    Re: Command line arguments

    Hari <anonymous@disc ussions.microso ft.com> wrote:[color=blue]
    > can i have command line arguments in VS.NET applicatio?
    > if yes how?
    > Can i have some code snippets of the above functionality?
    >
    > I know we can acjieve this in console application form
    > command prompt but how can i achieve it in an application
    > in VS.NET?[/color]

    Exactly the same way - make your Main method take a string array as a
    parameter, and then the command line arguments will be in the string
    array.

    --
    Jon Skeet - <skeet@pobox.co m>
    Pobox has been discontinued as a separate service, and all existing customers moved to the Fastmail platform.

    If replying to the group, please do not mail me too

    Comment

    • Hari

      #3
      Re: Command line arguments

      Thank you for the reply Jon Skeet

      But if i want to pass the command line arguments at run
      time how can i do in the VS.NET environment.

      Thank you in advance


      [color=blue]
      >-----Original Message-----
      >Hari <anonymous@disc ussions.microso ft.com> wrote:[color=green]
      >> can i have command line arguments in VS.NET applicatio?
      >> if yes how?
      >> Can i have some code snippets of the above[/color][/color]
      functionality?[color=blue][color=green]
      >>
      >> I know we can acjieve this in console application form
      >> command prompt but how can i achieve it in an[/color][/color]
      application[color=blue][color=green]
      >> in VS.NET?[/color]
      >
      >Exactly the same way - make your Main method take a[/color]
      string array as a[color=blue]
      >parameter, and then the command line arguments will be in[/color]
      the string[color=blue]
      >array.
      >
      >--
      >Jon Skeet - <skeet@pobox.co m>
      >http://www.pobox.com/~skeet
      >If replying to the group, please do not mail me too
      >.
      >[/color]

      Comment

      • phoenix

        #4
        Re: Command line arguments

        Project (menu) > xxx Properties > Configuration properties > Debugging >
        Start Options > Command Line Arguments

        Yves

        "Hari" <anonymous@disc ussions.microso ft.com> schreef in bericht
        news:04ac01c3d3 63$16ef7240$a50 1280a@phx.gbl.. .[color=blue]
        > Thank you for the reply Jon Skeet
        >
        > But if i want to pass the command line arguments at run
        > time how can i do in the VS.NET environment.
        >
        > Thank you in advance
        >
        >
        >[color=green]
        > >-----Original Message-----
        > >Hari <anonymous@disc ussions.microso ft.com> wrote:[color=darkred]
        > >> can i have command line arguments in VS.NET applicatio?
        > >> if yes how?
        > >> Can i have some code snippets of the above[/color][/color]
        > functionality?[color=green][color=darkred]
        > >>
        > >> I know we can acjieve this in console application form
        > >> command prompt but how can i achieve it in an[/color][/color]
        > application[color=green][color=darkred]
        > >> in VS.NET?[/color]
        > >
        > >Exactly the same way - make your Main method take a[/color]
        > string array as a[color=green]
        > >parameter, and then the command line arguments will be in[/color]
        > the string[color=green]
        > >array.
        > >
        > >--
        > >Jon Skeet - <skeet@pobox.co m>
        > >http://www.pobox.com/~skeet
        > >If replying to the group, please do not mail me too
        > >.
        > >[/color][/color]


        Comment

        • Donald L. Mull Jr.

          #5
          Re: Command line arguments

          As for reading the command line parameters, you can also use
          System.Environm ent.CommandLine or System.Environm ent.GetcommandL ineArgs()


          "phoenix" <patient0@skyne tWORK.be> wrote in message
          news:edFFWg20DH A.2580@TK2MSFTN GP09.phx.gbl...[color=blue]
          > Project (menu) > xxx Properties > Configuration properties > Debugging >
          > Start Options > Command Line Arguments
          >
          > Yves
          >
          > "Hari" <anonymous@disc ussions.microso ft.com> schreef in bericht
          > news:04ac01c3d3 63$16ef7240$a50 1280a@phx.gbl.. .[color=green]
          > > Thank you for the reply Jon Skeet
          > >
          > > But if i want to pass the command line arguments at run
          > > time how can i do in the VS.NET environment.
          > >
          > > Thank you in advance
          > >
          > >
          > >[color=darkred]
          > > >-----Original Message-----
          > > >Hari <anonymous@disc ussions.microso ft.com> wrote:
          > > >> can i have command line arguments in VS.NET applicatio?
          > > >> if yes how?
          > > >> Can i have some code snippets of the above[/color]
          > > functionality?[color=darkred]
          > > >>
          > > >> I know we can acjieve this in console application form
          > > >> command prompt but how can i achieve it in an[/color]
          > > application[color=darkred]
          > > >> in VS.NET?
          > > >
          > > >Exactly the same way - make your Main method take a[/color]
          > > string array as a[color=darkred]
          > > >parameter, and then the command line arguments will be in[/color]
          > > the string[color=darkred]
          > > >array.
          > > >
          > > >--
          > > >Jon Skeet - <skeet@pobox.co m>
          > > >http://www.pobox.com/~skeet
          > > >If replying to the group, please do not mail me too
          > > >.
          > > >[/color][/color]
          >
          >[/color]


          Comment

          • Guest's Avatar

            #6
            Re: Command line arguments

            Thank you

            Donald[color=blue]
            >-----Original Message-----
            >As for reading the command line parameters, you can also[/color]
            use[color=blue]
            >System.Environ ment.CommandLin e or[/color]
            System.Environm ent.GetcommandL ineArgs()[color=blue]
            >
            >
            >"phoenix" <patient0@skyne tWORK.be> wrote in message
            >news:edFFWg20D HA.2580@TK2MSFT NGP09.phx.gbl.. .[color=green]
            >> Project (menu) > xxx Properties > Configuration[/color][/color]
            properties > Debugging >[color=blue][color=green]
            >> Start Options > Command Line Arguments
            >>
            >> Yves
            >>
            >> "Hari" <anonymous@disc ussions.microso ft.com> schreef in[/color][/color]
            bericht[color=blue][color=green]
            >> news:04ac01c3d3 63$16ef7240$a50 1280a@phx.gbl.. .[color=darkred]
            >> > Thank you for the reply Jon Skeet
            >> >
            >> > But if i want to pass the command line arguments at[/color][/color][/color]
            run[color=blue][color=green][color=darkred]
            >> > time how can i do in the VS.NET environment.
            >> >
            >> > Thank you in advance
            >> >
            >> >
            >> >
            >> > >-----Original Message-----
            >> > >Hari <anonymous@disc ussions.microso ft.com> wrote:
            >> > >> can i have command line arguments in VS.NET[/color][/color][/color]
            applicatio?[color=blue][color=green][color=darkred]
            >> > >> if yes how?
            >> > >> Can i have some code snippets of the above
            >> > functionality?
            >> > >>
            >> > >> I know we can acjieve this in console application[/color][/color][/color]
            form[color=blue][color=green][color=darkred]
            >> > >> command prompt but how can i achieve it in an
            >> > application
            >> > >> in VS.NET?
            >> > >
            >> > >Exactly the same way - make your Main method take a
            >> > string array as a
            >> > >parameter, and then the command line arguments will[/color][/color][/color]
            be in[color=blue][color=green][color=darkred]
            >> > the string
            >> > >array.
            >> > >
            >> > >--
            >> > >Jon Skeet - <skeet@pobox.co m>
            >> > >http://www.pobox.com/~skeet
            >> > >If replying to the group, please do not mail me too
            >> > >.
            >> > >[/color]
            >>
            >>[/color]
            >
            >
            >.
            >[/color]

            Comment

            • Jason He

              #7
              Re: Command line arguments

              In your projects property page, choose Configuration Properties.
              You can specify Command line arguments there.

              Thanks

              Jason

              Comment

              Working...