FraserOfSmeg
FraserOfSmeg

Reputation: 1148

Process.Start() makes a .exe file flash open then instantly close again

I'm trying to start a .exe file using vb.net. I'm currently using the following code:

Process.Start("PathName")

Where "PathName" is the full location of the file and the name of the file including extension. The file does open, but it immediately closes. It is open for far less than a second but I can see it open. When I run the .exe file by double clicking on it it runs, loads a few things and then waits for further input. Why does this not happen with process.start?

Upvotes: 0

Views: 708

Answers (2)

ileff
ileff

Reputation: 358

Try this:

Shell("Pathname", AppWinStyle.NormalFocus, False, -1)

Upvotes: 2

Guru Josh
Guru Josh

Reputation: 575

You are trying to open the string literal "PathName". If the path is in a string variable called PathName then drop the quotation marks:

Dim PathName As String = "C:\My Folder\My Program.exe"
Process.Start(PathName)

Upvotes: -1

Related Questions