Executing another application from one vb.net application

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi All,

Would anybody be able to post me the command used in vb.net to execute an
application from within the current application?

Thanks.
kd
 
Thanks Ligthert.

The arguments for to execute my application contains a switch /S followed by
the argument. The following code however is failing.
Dim p As New Process
Dim pi As New ProcessStartInfo
pi.arguments = "/S testarg"
pi.FileName = "C:\Program files\MyApp\test.exe"
p.startinfo = pi
p.Start()

I am not sure if this is the correct way to pass multiple arguments!

Help is greatly appreciated.

kd
 
kd said:
Would anybody be able to post me the command used in vb.net to execute an
application from within the current application?

\\\
Imports System.Diagnostics
..
..
..
Process.Start("notepad", """C:\Bla Bla\1.txt""")
///

- or -

\\\
Shell("notepad ""C:\Bla Bla\1.txt""", AppWinStyle.NormalFocus)
///
 
Kd,

You can always try this from the (DOSbox) commandline.
When it does it like that, than this would do it in my opinion as well as
you wrote it.

Cor
 
Cor,

The command runs successfully when executed from the command window. But
fails when executed through the vb.net code.

kd
 
And what is the behaviour.

Did you try it with notepad in the same place?
(other arguments of course)

Cor
 
Cor,

Running notepad is working. Notepad.exe takes just one argument. So, does
IE. I was looking for any application that takes more than one argument,
along with switches, in order to test where the problem lies. If you do come
across any, please post it here, so that I can test it.

Regards.
kd.
 
KD,

I checked it with this program and it did as expected.

\\\
Public Class KDtest
Public Shared Sub main(ByVal args() As String)
If args.Length > 0 Then
If args(0).ToUpper = "\S" Then
MessageBox.Show(args(1))
End If
Else
Dim p As New Process
Dim pi As New ProcessStartInfo
pi.Arguments = "\S Hello"
pi.FileName = "KD"
p.StartInfo = pi
p.Start()
End If
End Sub
End Class
///

I hope this helps?

Cor
 
kd said:
Running notepad is working. Notepad.exe takes just one argument. So, does
IE. I was looking for any application that takes more than one argument,
along with switches, in order to test where the problem lies. If you do
come
across any, please post it here, so that I can test it.

Depending on the application, certain parameter values need to be put
between double quotes, for example, file names containing space characters.
Maybe this is causing your problem.
 
The application is running successfully now.

Thanks Cor, your assistance was of great help.

kd.
 
Back
Top