Running program in VB.NET doesn't work?

  • Thread starter Joris De Groote
  • Start date
J

Joris De Groote

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(commando)
p.WaitForExit()

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

So this is the commando: C:\Program Files\winrar\WinRAR.exe" E -y
c:\Test\Backup\UParchive_20060303.zip C:\Test\temp\

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

Thanks
Joris
 
C

Cor Ligthert [MVP]

Joris,

Yes you miss the arguments property.

Not tested could it be something as this

\\\
Dim p As New Process
Dim pi As New ProcessStartInfo
pi.UseShellExecute = False
pi.RedirectStandardOutput = True
pi.Arguments = "E -y c:\Test\Backup\UParchive_20060303.zip C:\Test\temp\"
pi.WorkingDirectory = "C:\Program Files\winrar\"
pi.FileName = "WinRar.Exe"
p.StartInfo = pi
p.Start()
///

I hope this heps.

Cor
 
J

Joris De Groote

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.ComponentModel.Win32Exception'
occurred in system.dll
Additional information: The system cannot find the file specified


Greetz
Joris
 
J

Joris De Groote

Hi,

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

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

Dim p As Process = Process.Start(getwinrar(), commando)

p.WaitForExit()

Thanks for the help
 
F

Frederik Vanderhaeghe

ja gie pipo, wistje da nie?
Joris De Groote said:
Hi,

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

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

Dim p As Process = Process.Start(getwinrar(), commando)

p.WaitForExit()

Thanks for the help
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top