How TO: Execute Files in .NET

Skip Navigation LinksIrocon > Blog > 2005 > October, 2005 > October 10, 2005 > How TO: Execute Files in .NET

How TO: Execute Files in .NET

Dim sProc As New Process()
Try
If File.Exists(strPath) Then

sProc.StartInfo.FileName = strPath
sProc.StartInfo.UseShellExecute = True
sProc.Start()
'sProc.WaitForExit()
End If
Catch exFNF As FileNotFoundException
MessageBox.Show("The file: '" & strPath & "' could not be found!", "File not found!")
Catch ex As Exception
MessageBox.Show(ex.Message, "Exception")
Finally
sProc.Dispose()
End Try

Last Updated:Thursday, September 02, 2010By:alfero#

Would you like to comment?

Sign in with your OpenID. If you do not know what OpenID is, find out.