Invoking a command line .exe program

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

    Invoking a command line .exe program

    Hi,

    I have a simple .exe application that I need to invoke from my C#
    application. I need to send it two strings and then get the result back.

    Can anyone advise me on how this is done?

    Also, I'm currently using a windows forms application but I would like to
    use an ASP.net appliocation to invoke the .exe file in the future. Is this
    possible and will it cause any complications?

    Thanks everyone

    Simon


  • Shiva

    #2
    Re: Invoking a command line .exe program

    Hi,

    Did you try System.Diagnost ics.Process.Sta rt()?

    "Simon Harvey" <sh856531@micro softs_free_emai l_service.com> wrote in message
    news:#IB5#oVdEH A.3792@TK2MSFTN GP09.phx.gbl...
    Hi,

    I have a simple .exe application that I need to invoke from my C#
    application. I need to send it two strings and then get the result back.

    Can anyone advise me on how this is done?

    Also, I'm currently using a windows forms application but I would like to
    use an ASP.net appliocation to invoke the .exe file in the future. Is this
    possible and will it cause any complications?

    Thanks everyone

    Simon



    Comment

    • Christian Heide Damm

      #3
      Re: Invoking a command line .exe program

      Answer to the first part of the question: take a look at
      System.Diagnost ics.Process.

      Christian


      "Simon Harvey" <sh856531@micro softs_free_emai l_service.com> wrote in message
      news:%23IB5%23o VdEHA.3792@TK2M SFTNGP09.phx.gb l...[color=blue]
      > Hi,
      >
      > I have a simple .exe application that I need to invoke from my C#
      > application. I need to send it two strings and then get the result back.
      >
      > Can anyone advise me on how this is done?
      >
      > Also, I'm currently using a windows forms application but I would like to
      > use an ASP.net appliocation to invoke the .exe file in the future. Is this
      > possible and will it cause any complications?
      >
      > Thanks everyone
      >
      > Simon
      >
      >[/color]


      Comment

      • Eliyahu Goldin

        #4
        Re: Invoking a command line .exe program

        Simon,

        ASP.NET application can invoke an ece in the same way as Windows form one.
        The only difference is that you will need to grant "run executable" rights
        to account aspnet runs under.

        Eliyahu

        "Simon Harvey" <sh856531@micro softs_free_emai l_service.com> wrote in message
        news:%23IB5%23o VdEHA.3792@TK2M SFTNGP09.phx.gb l...[color=blue]
        > Hi,
        >
        > I have a simple .exe application that I need to invoke from my C#
        > application. I need to send it two strings and then get the result back.
        >
        > Can anyone advise me on how this is done?
        >
        > Also, I'm currently using a windows forms application but I would like to
        > use an ASP.net appliocation to invoke the .exe file in the future. Is this
        > possible and will it cause any complications?
        >
        > Thanks everyone
        >
        > Simon
        >
        >[/color]


        Comment

        • Irfan

          #5
          Invoking a command line .exe program

          Hi,

          simplest thing would be using the below line of code

          System.Diagnost ics.Process.Sta rt(@"yourpath to your
          application\Win dApp.exe");

          HTH
          irfan

          Comment

          • Nick Malik

            #6
            Re: Invoking a command line .exe program

            The other responders gave you the answer.

            I have a question: did you write the command line app? If so, can it be
            rewritten in .NET?
            That would give you some better answers when it comes to using resources,
            especially if you plan to run this in a server.

            Running it from a web page will work, but it won't be terribly scalable.

            --- Nick

            "Simon Harvey" <sh856531@micro softs_free_emai l_service.com> wrote in message
            news:%23IB5%23o VdEHA.3792@TK2M SFTNGP09.phx.gb l...[color=blue]
            > Hi,
            >
            > I have a simple .exe application that I need to invoke from my C#
            > application. I need to send it two strings and then get the result back.
            >
            > Can anyone advise me on how this is done?
            >
            > Also, I'm currently using a windows forms application but I would like to
            > use an ASP.net appliocation to invoke the .exe file in the future. Is this
            > possible and will it cause any complications?
            >
            > Thanks everyone
            >
            > Simon
            >
            >[/color]


            Comment

            • Eric Johannsen

              #7
              Re: Invoking a command line .exe program

              Giving the ASPNET account "run executable" rights is a terrible security
              hole. I would strongly suggest that you look for another solution to your
              problem, perhaps rewriting the executable as a windows service (or wrapping
              it on one) and having the ASP application set certain conditions (such as a
              flag in the DB) that cause the code currently in the executable to run.

              Eric
              [color=blue]
              > ASP.NET application can invoke an ece in the same way as Windows form one.
              > The only difference is that you will need to grant "run executable" rights
              > to account aspnet runs under.[/color]

              Comment

              Working...