Home All Groups Group Topic Archive Search About

Running program in VB.NET doesn't work?

Author
5 Apr 2006 10:24 AM
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

Author
5 Apr 2006 11:13 AM
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
Author
5 Apr 2006 11:44 AM
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


Show quoteHide quote
"Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message
news:eROY3GKWGHA.1220@TK2MSFTNGP02.phx.gbl...
> 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
>
Author
5 Apr 2006 12:20 PM
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


Show quoteHide quote
"Joris De Groote" <joris.degro***@skynet.be> wrote in message
news:%23TSNdZKWGHA.4292@TK2MSFTNGP04.phx.gbl...
> 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
>
>
> "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message
> news:eROY3GKWGHA.1220@TK2MSFTNGP02.phx.gbl...
>> 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
>>
>
>
Author
5 Apr 2006 12:47 PM
Frederik Vanderhaeghe
ja gie pipo, wistje da nie?
Show quoteHide quote
"Joris De Groote" <joris.degro***@skynet.be> wrote in message
news:%23zPyftKWGHA.4148@TK2MSFTNGP03.phx.gbl...
> 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
>
>
> "Joris De Groote" <joris.degro***@skynet.be> wrote in message
> news:%23TSNdZKWGHA.4292@TK2MSFTNGP04.phx.gbl...
>> 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
>>
>>
>> "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message
>> news:eROY3GKWGHA.1220@TK2MSFTNGP02.phx.gbl...
>>> 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
>>>
>>
>>
>
>