Passing command line arguments to exe coded in C#

Discussion in 'C#' started by Mobalak88, Mar 14, 2011.

  1. Mobalak88

    Mobalak88 New Member

    Joined:
    Mar 14, 2011
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    developer
    Location:
    bangalore
    Hi all,

    I am using both the forms and command line arguments in my C# project. The progra must execute in this way :

    If the command line arguments are given by the user, the exe must consider that as the input and process. Else it should display the form to the user for the input.

    It is working fine if it is executed in the visual studio but if we ompile and create the exe with the command line args, it is taking those input as the default and processing with out considering the user input. If compliled with out the arguments, it is displaying the form.

    I hope some one would have a solution. Please post your replies as soon as possible since it is urgent.

    Thanks in advance

    Regards,

    Mobalak88
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    How are you passing the command line input to the final compiled exe?
     
  3. Mobalak88

    Mobalak88 New Member

    Joined:
    Mar 14, 2011
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    developer
    Location:
    bangalore
    I have a seperate class commandLineParser defined which reads the command line arguments from the main and parses them.
     
  4. Mobalak88

    Mobalak88 New Member

    Joined:
    Mar 14, 2011
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    developer
    Location:
    bangalore
    in DOS, i will set the path, then


    filename.exe -darg1 -farg2 etc.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice