The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Process Class

Provides access to local and remote processes and enables you to start and stop local system processes.

Namespace:  System.Diagnostics
Assembly:  System (in System.dll)

<HostProtectionAttribute(SecurityAction.LinkDemand, SharedState := True, Synchronization := True,  _
	ExternalProcessMgmt := True, SelfAffectingProcessMgmt := True)> _
<PermissionSetAttribute(SecurityAction.LinkDemand, Name := "FullTrust")> _
<PermissionSetAttribute(SecurityAction.InheritanceDemand, Name := "FullTrust")> _
Public Class Process _
	Inherits Component
Dim instance As Process


The HostProtectionAttribute attribute applied to this type or member has the following Resources property value: SharedState | Synchronization | ExternalProcessMgmt | SelfAffectingProcessMgmt. The HostProtectionAttribute does not affect desktop applications (which are typically started by double-clicking an icon, typing a command, or entering a URL in a browser). For more information, see the HostProtectionAttribute class or SQL Server Programming and Host Protection Attributes.


Starting with the .NET Framework version 2.0, the ability to reference performance counter data on other computers has been eliminated for many of the .NET Framework methods and properties. This change was made to improve performance and to enable non-administrators to use the Process class. As a result, some applications that did not get exceptions in earlier versions of the .NET Framework may now get a NotSupportedException. The methods and properties affected are too numerous to list here, but the exception information has been added to the affected member topics.

A Process component provides access to a process that is running on a computer. A process, in the simplest terms, is a running application. A thread is the basic unit to which the operating system allocates processor time. A thread can execute any part of the code of the process, including parts currently being executed by another thread.

The Process component is a useful tool for starting, stopping, controlling, and monitoring applications. Using the Process component, you can obtain a list of the processes that are running, or you can start a new process. A Process component is used to access system processes. After a Process component has been initialized, it can be used to obtain information about the running process. Such information includes the set of threads, the loaded modules (.dll and .exe files), and performance information such as the amount of memory the process is using.


A 32-bit processes cannot access the modules of a 64-bit process. If you try to get information about a 64-bit process from a 32-bit process, you will get a Win32Exception exception.

If you have a path variable declared in your system using quotes, you must fully qualify that path when starting any process found in that location. Otherwise, the system will not find the path. For example, if c:\mypath is not in your path, and you add it using quotation marks: path = %path%;"c:\mypath", you must fully qualify any process in c:\mypath when starting it.

The process component obtains information about a group of properties all at once. After the Process component has obtained information about one member of any group, it will cache the values for the other properties in that group and not obtain new information about the other members of the group until you call the Refresh method. Therefore, a property value is not guaranteed to be any newer than the last call to the Refresh method. The group breakdowns are operating-system dependent.

A system process is uniquely identified on the system by its process identifier. Like many Windows resources, a process is also identified by its handle, which might not be unique on the computer. A handle is the generic term for an identifier of a resource. The operating system persists the process handle, which is accessed through the Handle property of the Process component, even when the process has exited. Thus, you can get the process's administrative information, such as the ExitCode (usually either zero for success or a nonzero error code) and the ExitTime. Handles are an extremely valuable resource, so leaking handles is more virulent than leaking memory.


This class contains a link demand and an inheritance demand at the class level that applies to all members. A SecurityException is thrown when either the immediate caller or the derived class does not have full-trust permission. For details about security demands, see Link Demands and Inheritance Demands.

The following example uses an instance of the Process class to start a process.

Imports System
Imports System.Diagnostics
Imports System.ComponentModel

Namespace MyProcessSample

    Class MyProcess

        Public Shared Sub Main()
            Dim myProcess As New Process()

            Try                ' Get the path that stores user documents.

                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
                ' 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
            End Try 
        End Sub 'Main
    End Class 
End Namespace

The following example uses the Process class itself and a static Start method to start a process.

Imports System
Imports System.Diagnostics
Imports System.ComponentModel

Namespace MyProcessSample
   Class MyProcess
      ' Opens the Internet Explorer application. 
      Public Sub OpenApplication(myFavoritesPath As String)
         ' Start Internet Explorer. Defaults to the home page.

         ' Display the contents of the favorites folder in the browser.
      End Sub 'OpenApplication

      ' Opens urls and .html documents using Internet Explorer. 
      Sub OpenWithArguments()
         ' url's are not considered documents. They can only be opened 
         ' by passing them as arguments.
         Process.Start("IExplore.exe", "")

         ' Start a Web page using a browser associated with .html and .asp files.
         Process.Start("IExplore.exe", "C:\myPath\myFile.htm")
         Process.Start("IExplore.exe", "C:\myPath\myFile.asp")
      End Sub 'OpenWithArguments

      ' Uses the ProcessStartInfo class to start new processes, 
      ' both in a minimized mode. 
      Sub OpenWithStartInfo()
         Dim startInfo As New ProcessStartInfo("IExplore.exe")
         startInfo.WindowStyle = ProcessWindowStyle.Minimized


         startInfo.Arguments = ""

      End Sub 'OpenWithStartInfo

      Shared Sub Main()
         ' Get the path that stores favorite links. 
         Dim myFavoritesPath As String = Environment.GetFolderPath(Environment.SpecialFolder.Favorites)

         Dim myProcess As New MyProcess()

      End Sub 'Main
   End Class 'MyProcess
End Namespace 'MyProcessSample

  • LinkDemand 

    for full trust for the immediate caller. This class cannot be used by partially trusted code.

  • InheritanceDemand 

    for full trust for inheritors. This class cannot be inherited by partially trusted code.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 3.5, 2.0

Community Additions