Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. command line arguments

command line arguments

Scheduled Pinned Locked Moved C#
csharpquestion
7 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Maddie from Dartford
    wrote on last edited by
    #1

    Hello, I am developing C# form application. I want to pass some user editable command line data to application before execution. So that i can read it before main() gets execute. How can i pass these data and read it from my application. Thanks. Gajesh

    O C A 3 Replies Last reply
    0
    • M Maddie from Dartford

      Hello, I am developing C# form application. I want to pass some user editable command line data to application before execution. So that i can read it before main() gets execute. How can i pass these data and read it from my application. Thanks. Gajesh

      O Offline
      O Offline
      originSH
      wrote on last edited by
      #2

      static void Main(string[] args) {} where args is a string aray that has the command line arguments in it split by spaces. Heres one of the articles you'll find right here on codeproject if you search ... http://www.codeproject.com/csharp/Command_Line.asp[^]

      M 1 Reply Last reply
      0
      • O originSH

        static void Main(string[] args) {} where args is a string aray that has the command line arguments in it split by spaces. Heres one of the articles you'll find right here on codeproject if you search ... http://www.codeproject.com/csharp/Command_Line.asp[^]

        M Offline
        M Offline
        Maddie from Dartford
        wrote on last edited by
        #3

        thanks originSH, But how end user will pass data from application exe? I thought of editing the application properties(RClick on application icon -> propertry) but i couldn't find command line editor in any of the tab. Thanks.

        C G 2 Replies Last reply
        0
        • M Maddie from Dartford

          Hello, I am developing C# form application. I want to pass some user editable command line data to application before execution. So that i can read it before main() gets execute. How can i pass these data and read it from my application. Thanks. Gajesh

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          gajesh wrote:

          So that i can read it before main() gets execute.

          Nothing happens before main gets executed. Your command line args are available from the Application object, however.

          Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

          1 Reply Last reply
          0
          • M Maddie from Dartford

            thanks originSH, But how end user will pass data from application exe? I thought of editing the application properties(RClick on application icon -> propertry) but i couldn't find command line editor in any of the tab. Thanks.

            C Offline
            C Offline
            Christian Graus
            wrote on last edited by
            #5

            gajesh wrote:

            But how end user will pass data from application exe?

            *from* the app ? You can pass data TO the app, on the command line.

            gajesh wrote:

            I thought of editing the application properties(RClick on application icon -> propertry) but i couldn't find command line editor in any of the tab.

            you can only edit the command line of a shortcut, not the app itself

            Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

            1 Reply Last reply
            0
            • M Maddie from Dartford

              thanks originSH, But how end user will pass data from application exe? I thought of editing the application properties(RClick on application icon -> propertry) but i couldn't find command line editor in any of the tab. Thanks.

              G Offline
              G Offline
              Giorgi Dalakishvili
              wrote on last edited by
              #6

              gajesh wrote:

              But how end user will pass data from application exe?

              Either by launching program from cmd or by modifying target which is on the shortcut tab of properties window

              #region signature my articles #endregion

              1 Reply Last reply
              0
              • M Maddie from Dartford

                Hello, I am developing C# form application. I want to pass some user editable command line data to application before execution. So that i can read it before main() gets execute. How can i pass these data and read it from my application. Thanks. Gajesh

                A Offline
                A Offline
                atulonweb hotmail com
                wrote on last edited by
                #7

                I think you are talking about console application in c# if u look at your main method static void Main(string[] args) { // // TODO: Add code to start application here // /// Added next line to print input on console Console.WriteLine(args[0]); } it accepts array of string, this is area where u can pass values e.g myapplication.exe parameter Atul kumar

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups