Running program in VB.NET doesn't work?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Joris De Groote

    Running program in VB.NET doesn't work?

    Hi

    I am trying to run winrar from VB.NET. I do this:
    Dim commando As String
    commando = " E -y " + getbackupmap() + naam + " " + gettempmap()
    commando = """" + getwinrar() + """" + commando
    Dim p As Process = Process.Start(c ommando)
    p.WaitForExit()

    Now I get this error:
    An unhandled exception of type 'System.Compone ntModel.Win32Ex ception'
    occurred in system.dll
    Additional information: The system cannot find the file specified

    So this is the commando: C:\Program Files\winrar\Wi nRAR.exe" E -y
    c:\Test\Backup\ UParchive_20060 303.zip C:\Test\temp\

    When I do this in start-run it works... Am I missing something?

    Thanks
    Joris




  • Cor Ligthert [MVP]

    #2
    Re: Running program in VB.NET doesn't work?

    Joris,

    Yes you miss the arguments property.

    Not tested could it be something as this

    \\\
    Dim p As New Process
    Dim pi As New ProcessStartInf o
    pi.UseShellExec ute = False
    pi.RedirectStan dardOutput = True
    pi.Arguments = "E -y c:\Test\Backup\ UParchive_20060 303.zip C:\Test\temp\"
    pi.WorkingDirec tory = "C:\Program Files\winrar\"
    pi.FileName = "WinRar.Exe "
    p.StartInfo = pi
    p.Start()
    ///

    I hope this heps.

    Cor


    Comment

    • Joris De Groote

      #3
      Re: Running program in VB.NET doesn't work?

      Hi,

      I put my old code in comment and added in this code, it looks a lot better,
      however, I still get the same error. I checked everything from the argument
      again, but I still get this:

      An unhandled exception of type 'System.Compone ntModel.Win32Ex ception'
      occurred in system.dll
      Additional information: The system cannot find the file specified


      Greetz
      Joris


      "Cor Ligthert [MVP]" <notmyfirstname @planet.nl> wrote in message
      news:eROY3GKWGH A.1220@TK2MSFTN GP02.phx.gbl...[color=blue]
      > Joris,
      >
      > Yes you miss the arguments property.
      >
      > Not tested could it be something as this
      >
      > \\\
      > Dim p As New Process
      > Dim pi As New ProcessStartInf o
      > pi.UseShellExec ute = False
      > pi.RedirectStan dardOutput = True
      > pi.Arguments = "E -y c:\Test\Backup\ UParchive_20060 303.zip C:\Test\temp\"
      > pi.WorkingDirec tory = "C:\Program Files\winrar\"
      > pi.FileName = "WinRar.Exe "
      > p.StartInfo = pi
      > p.Start()
      > ///
      >
      > I hope this heps.
      >
      > Cor
      >[/color]


      Comment

      • Joris De Groote

        #4
        Re: Running program in VB.NET doesn't work?

        Hi,

        It works now, I used this:
        Dim commando As String

        commando = "E -y " + getbackupmap() + naam + " " + gettempmap()

        Dim p As Process = Process.Start(g etwinrar(), commando)

        p.WaitForExit()

        Thanks for the help


        "Joris De Groote" <joris.degroote @skynet.be> wrote in message
        news:%23TSNdZKW GHA.4292@TK2MSF TNGP04.phx.gbl. ..[color=blue]
        > Hi,
        >
        > I put my old code in comment and added in this code, it looks a lot
        > better, however, I still get the same error. I checked everything from the
        > argument again, but I still get this:
        >
        > An unhandled exception of type 'System.Compone ntModel.Win32Ex ception'
        > occurred in system.dll
        > Additional information: The system cannot find the file specified
        >
        >
        > Greetz
        > Joris
        >
        >
        > "Cor Ligthert [MVP]" <notmyfirstname @planet.nl> wrote in message
        > news:eROY3GKWGH A.1220@TK2MSFTN GP02.phx.gbl...[color=green]
        >> Joris,
        >>
        >> Yes you miss the arguments property.
        >>
        >> Not tested could it be something as this
        >>
        >> \\\
        >> Dim p As New Process
        >> Dim pi As New ProcessStartInf o
        >> pi.UseShellExec ute = False
        >> pi.RedirectStan dardOutput = True
        >> pi.Arguments = "E -y c:\Test\Backup\ UParchive_20060 303.zip C:\Test\temp\"
        >> pi.WorkingDirec tory = "C:\Program Files\winrar\"
        >> pi.FileName = "WinRar.Exe "
        >> p.StartInfo = pi
        >> p.Start()
        >> ///
        >>
        >> I hope this heps.
        >>
        >> Cor
        >>[/color]
        >
        >[/color]


        Comment

        • Frederik Vanderhaeghe

          #5
          Re: Running program in VB.NET doesn't work?

          ja gie pipo, wistje da nie?
          "Joris De Groote" <joris.degroote @skynet.be> wrote in message
          news:%23zPyftKW GHA.4148@TK2MSF TNGP03.phx.gbl. ..[color=blue]
          > Hi,
          >
          > It works now, I used this:
          > Dim commando As String
          >
          > commando = "E -y " + getbackupmap() + naam + " " + gettempmap()
          >
          > Dim p As Process = Process.Start(g etwinrar(), commando)
          >
          > p.WaitForExit()
          >
          > Thanks for the help
          >
          >
          > "Joris De Groote" <joris.degroote @skynet.be> wrote in message
          > news:%23TSNdZKW GHA.4292@TK2MSF TNGP04.phx.gbl. ..[color=green]
          >> Hi,
          >>
          >> I put my old code in comment and added in this code, it looks a lot
          >> better, however, I still get the same error. I checked everything from
          >> the argument again, but I still get this:
          >>
          >> An unhandled exception of type 'System.Compone ntModel.Win32Ex ception'
          >> occurred in system.dll
          >> Additional information: The system cannot find the file specified
          >>
          >>
          >> Greetz
          >> Joris
          >>
          >>
          >> "Cor Ligthert [MVP]" <notmyfirstname @planet.nl> wrote in message
          >> news:eROY3GKWGH A.1220@TK2MSFTN GP02.phx.gbl...[color=darkred]
          >>> Joris,
          >>>
          >>> Yes you miss the arguments property.
          >>>
          >>> Not tested could it be something as this
          >>>
          >>> \\\
          >>> Dim p As New Process
          >>> Dim pi As New ProcessStartInf o
          >>> pi.UseShellExec ute = False
          >>> pi.RedirectStan dardOutput = True
          >>> pi.Arguments = "E -y c:\Test\Backup\ UParchive_20060 303.zip
          >>> C:\Test\temp\"
          >>> pi.WorkingDirec tory = "C:\Program Files\winrar\"
          >>> pi.FileName = "WinRar.Exe "
          >>> p.StartInfo = pi
          >>> p.Start()
          >>> ///
          >>>
          >>> I hope this heps.
          >>>
          >>> Cor
          >>>[/color]
          >>
          >>[/color]
          >
          >[/color]


          Comment

          Working...