Process.Start vs. Command line syntax

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

    Process.Start vs. Command line syntax

    I'm trying to programatically run an app.
    The command line syntax is:
    "C:\Program Files\WinSCP3\W inSCP3.exe" -script=myscript .txt
    and it works as intended.


    In code, I have this
    Dim myProc As Process = New Process()

    myProc.StartInf o.FileName = "C:\Program Files\WinSCP3\W inSCP3.exe"
    I've also tried """C:\Progr am Files\WinSCP3\W inSCP3.exe"""

    myProc.StartInf o.Arguments = "-script=myscript .txt"

    myProc.Start()



    This doesn't work and doesn't produce an error.

    What am I doing wrong?

    thanks

    Kevin Vogler


  • kimiraikkonen

    #2
    Re: Process.Start vs. Command line syntax

    On Aug 29, 11:59 pm, "Kevin Vogler" <kvog...@phoeni xgrouppos.com>
    wrote:
    I'm trying to programatically run an app.
    The command line syntax is:
    "C:\Program Files\WinSCP3\W inSCP3.exe" -script=myscript .txt
    and it works as intended.
    >
    In code, I have this
    Dim myProc As Process = New Process()
    >
    myProc.StartInf o.FileName = "C:\Program Files\WinSCP3\W inSCP3.exe"
    I've also tried """C:\Progr am Files\WinSCP3\W inSCP3.exe"""
    >
    myProc.StartInf o.Arguments = "-script=myscript .txt"
    >
    myProc.Start()
    >
    This doesn't work and doesn't produce an error.
    >
    What am I doing wrong?
    >
    thanks
    >
    Kevin Vogler
    Try this:

    Dim p As New Process
    Dim info As New ProcessStartInf o _
    ("C:\Program Files\WinSCP3\W inSCP3.exe", _
    "-script=myscript .txt")
    p.Start(info)


    Hope it works,

    Onur Güzel

    Comment

    • Gillard

      #3
      Re: Process.Start vs. Command line syntax

      Process.Start(" C:\Program Files\WinSCP3\W inSCP3.exe",
      "-script=myscript .txt")



      "kimiraikko nen" <kimiraikkonen8 5@gmail.comwrot e in message
      news:81c4600d-de41-4e3a-9676-a1f4354e22c3@k3 7g2000hsf.googl egroups.com...
      On Aug 29, 11:59 pm, "Kevin Vogler" <kvog...@phoeni xgrouppos.com>
      wrote:
      >I'm trying to programatically run an app.
      >The command line syntax is:
      >"C:\Program Files\WinSCP3\W inSCP3.exe" -script=myscript .txt
      >and it works as intended.
      >>
      >In code, I have this
      >Dim myProc As Process = New Process()
      >>
      >myProc.StartIn fo.FileName = "C:\Program Files\WinSCP3\W inSCP3.exe"
      >I've also tried """C:\Progr am Files\WinSCP3\W inSCP3.exe"""
      >>
      >myProc.StartIn fo.Arguments = "-script=myscript .txt"
      >>
      >myProc.Start ()
      >>
      >This doesn't work and doesn't produce an error.
      >>
      >What am I doing wrong?
      >>
      >thanks
      >>
      >Kevin Vogler
      >
      Try this:
      >
      Dim p As New Process
      Dim info As New ProcessStartInf o _
      ("C:\Program Files\WinSCP3\W inSCP3.exe", _
      "-script=myscript .txt")
      p.Start(info)
      >
      >
      Hope it works,
      >
      Onur Güzel

      Comment

      • Kevin Vogler

        #4
        Re: Process.Start vs. Command line syntax

        Thanks for the quick response.

        That doesn't work also.

        Maybe I've got this screwed up.

        I've been running the command line from the Run command not a terminal
        window. Does that make a difference.

        Thanks
        Kevin


        "kimiraikko nen" <kimiraikkonen8 5@gmail.comwrot e in message
        news:81c4600d-de41-4e3a-9676-a1f4354e22c3@k3 7g2000hsf.googl egroups.com...
        On Aug 29, 11:59 pm, "Kevin Vogler" <kvog...@phoeni xgrouppos.com>
        wrote:
        I'm trying to programatically run an app.
        The command line syntax is:
        "C:\Program Files\WinSCP3\W inSCP3.exe" -script=myscript .txt
        and it works as intended.
        >
        In code, I have this
        Dim myProc As Process = New Process()
        >
        myProc.StartInf o.FileName = "C:\Program Files\WinSCP3\W inSCP3.exe"
        I've also tried """C:\Progr am Files\WinSCP3\W inSCP3.exe"""
        >
        myProc.StartInf o.Arguments = "-script=myscript .txt"
        >
        myProc.Start()
        >
        This doesn't work and doesn't produce an error.
        >
        What am I doing wrong?
        >
        thanks
        >
        Kevin Vogler
        Try this:

        Dim p As New Process
        Dim info As New ProcessStartInf o _
        ("C:\Program Files\WinSCP3\W inSCP3.exe", _
        "-script=myscript .txt")
        p.Start(info)


        Hope it works,

        Onur Güzel


        Comment

        • =?ISO-8859-1?Q?G=F6ran_Andersson?=

          #5
          Re: Process.Start vs. Command line syntax

          Kevin Vogler wrote:
          I'm trying to programatically run an app.
          The command line syntax is:
          "C:\Program Files\WinSCP3\W inSCP3.exe" -script=myscript .txt
          and it works as intended.
          >
          >
          In code, I have this
          Dim myProc As Process = New Process()
          >
          myProc.StartInf o.FileName = "C:\Program Files\WinSCP3\W inSCP3.exe"
          I've also tried """C:\Progr am Files\WinSCP3\W inSCP3.exe"""
          >
          myProc.StartInf o.Arguments = "-script=myscript .txt"
          >
          myProc.Start()
          >
          >
          >
          This doesn't work and doesn't produce an error.
          >
          What am I doing wrong?
          >
          thanks
          >
          Kevin Vogler
          >
          What do you mean when you say that it "doesn't work"? What happens, and
          how does that differ from what you expect?

          --
          Göran Andersson
          _____
          Göran Anderssons privata hemsida.

          Comment

          • Kevin

            #6
            Re: Process.Start vs. Command line syntax

            Thanks for the response.
            When I put that command in Start/Run it runs a script that places a file in
            a folder via SFTP.

            When I put that command in a sub in a vb.net windows app and run it, nothing
            happens. No file, no errors thrown.

            At this point the myscript.txt file is in the same directory as the
            WinSCP3.exe. Do I have to give the absolute path to the myscript.txt since
            my app is now running out of my debug folder of my windows app as opposed to
            program I'm calling?

            I can't try this at the moment because I'm not in the office.

            Thanks
            Kevin Vogler

            "Göran Andersson" <guffa@guffa.co mwrote in message
            news:ubCswgpCJH A.4916@TK2MSFTN GP03.phx.gbl...
            Kevin Vogler wrote:
            >I'm trying to programatically run an app.
            >The command line syntax is:
            >"C:\Program Files\WinSCP3\W inSCP3.exe" -script=myscript .txt
            >and it works as intended.
            >>
            >>
            >In code, I have this
            >Dim myProc As Process = New Process()
            >>
            >myProc.StartIn fo.FileName = "C:\Program Files\WinSCP3\W inSCP3.exe" I've
            >also tried """C:\Progr am Files\WinSCP3\W inSCP3.exe"""
            >>
            >myProc.StartIn fo.Arguments = "-script=myscript .txt"
            >>
            >myProc.Start ()
            >>
            >>
            >>
            >This doesn't work and doesn't produce an error.
            >>
            >What am I doing wrong?
            >>
            >thanks
            >>
            >Kevin Vogler
            >>
            >
            What do you mean when you say that it "doesn't work"? What happens, and
            how does that differ from what you expect?
            >
            --
            Göran Andersson
            _____
            http://www.guffa.com

            Comment

            • Phill W.

              #7
              Re: Process.Start vs. Command line syntax

              Kevin Vogler wrote:
              I'm trying to programatically run an app.
              From where? What /sort/ of process?
              The command line syntax is:
              "C:\Program Files\WinSCP3\W inSCP3.exe" -script=myscript .txt
              and it works as intended.
              In code, I have this
              Dim myProc As Process = New Process()
              myProc.StartInf o.FileName = "C:\Program Files\WinSCP3\W inSCP3.exe"
              I've also tried """C:\Progr am Files\WinSCP3\W inSCP3.exe"""
              You don't need the quotes - the ProcessStartInf o class will take care of
              those for you.
              myProc.StartInf o.Arguments = "-script=myscript .txt"
              myProc.Start()
              Where does that /script/ live? How is WinScp3.exe supposed to find it?

              Try setting the .WorkingDirecto ry property as well (to the directory in
              which the script resides).
              This doesn't work and doesn't produce an error.
              If Process.Start couldn't find the .exe, you'd get an error all
              right(!), so that bit /must/ be working; I suspect it's just that the
              ..exe can't find the script.

              HTH,
              Phill W.

              Comment

              • Kevin Vogler

                #8
                Re: Process.Start vs. Command line syntax

                Phil,

                Thanks the response. It clarified a few things for me. Part of my problem
                was the syntax for a console window vs. the Run dialog. Once I sorted it out
                in the console window, I was able to get things to work in code.

                Thanks again,

                Kevin Vogler


                Comment

                Working...