Gets or sets the application or document to start.
Assembly: System (in System.dll)
'Declaration <MonitoringDescriptionAttribute("ProcessFileName")> _ <SettingsBindableAttribute(True)> _ <TypeConverterAttribute("System.Diagnostics.Design.StringValueConverter, System.Design, Version=18.104.22.168, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")> _ Public Property FileName As String
Property ValueType: System.String
The name of the application to start, or the name of a document of a file type that is associated with an application and that has a default open action available to it. The default is an empty string ("").
You must set at least the property before you start the process. The file name is any application or document. A document is defined to be any file type that has an open or default action associated with it. You can view registered file types and their associated applications for your computer by using the Folder Options dialog box, which is available through the operating system. The Advanced button leads to a dialog box that shows whether there is an open action associated with a specific registered file type.
The set of file types available to you depends in part on the value of the UseShellExecute property. If UseShellExecute is true, you can start any document and perform operations on the file, such as printing, with the Process component. When UseShellExecute is false, you can start only executables with the Process component.
You can start a ClickOnce application by setting the property to the location (for example, a Web address) from which you originally installed the application. Do not start a ClickOnce application by specifying its installed location on your hard disk.
Imports System Imports System.Diagnostics Imports System.ComponentModel Namespace MyProcessSample Class MyProcess Public Shared Sub Main() Dim myProcess As New Process() Try myProcess.StartInfo.UseShellExecute = False ' You can start any process, HelloWorld is a do-nothing example. myProcess.StartInfo.FileName = "C:\\HelloWorld.exe" myProcess.StartInfo.CreateNoWindow = True myProcess.Start() ' This code assumes the process you are starting will terminate itself. ' Given that is is started without a window so you cannot terminate it ' on the desktop, it must terminate itself or you can do it programmatically ' from this application using the Kill method. Catch e As Exception Console.WriteLine((e.Message)) End Try End Sub 'Main End Class End Namespace