Process Process Process Process Class

Definition

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

public ref class Process : System::ComponentModel::Component
public class Process : System.ComponentModel.Component
type Process = class
    inherit Component
Public Class Process
Inherits Component
Inheritance

Examples

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

#using <System.dll>
using namespace System;
using namespace System::Diagnostics;
using namespace System::ComponentModel;

int main()
{
    Process^ myProcess = gcnew 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 ( Exception^ e ) 
    {
        Console::WriteLine( e->Message );
    }
}
using System;
using System.Diagnostics;
using System.ComponentModel;

namespace MyProcessSample
{
    class MyProcess
    {
        public static void Main()
        {
            Process myProcess = 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 (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
    }
}
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

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

#using <System.dll>

using namespace System;
using namespace System::Diagnostics;
using namespace System::ComponentModel;

// Opens the Internet Explorer application.
void OpenApplication(String^ myFavoritesPath)
{
    // Start Internet Explorer. Defaults to the home page.
    Process::Start("IExplore.exe");

    // Display the contents of the favorites folder in the browser.
    Process::Start(myFavoritesPath);
}

// Opens urls and .html documents using Internet Explorer.
void OpenWithArguments()
{
    // url's are not considered documents. They can only be opened
    // by passing them as arguments.
    Process::Start("IExplore.exe", "www.northwindtraders.com");

    // 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");
}

// Uses the ProcessStartInfo class to start new processes,
// both in a minimized mode.
void OpenWithStartInfo()
{
    ProcessStartInfo^ startInfo = gcnew ProcessStartInfo("IExplore.exe");
    startInfo->WindowStyle = ProcessWindowStyle::Minimized;
    Process::Start(startInfo);
    startInfo->Arguments = "www.northwindtraders.com";
    Process::Start(startInfo);
}

int main()
{
    // Get the path that stores favorite links.
    String^ myFavoritesPath = Environment::GetFolderPath(Environment::SpecialFolder::Favorites);
    OpenApplication(myFavoritesPath);
    OpenWithArguments();
    OpenWithStartInfo();
}
using System;
using System.Diagnostics;
using System.ComponentModel;

namespace MyProcessSample
{
    class MyProcess
    {
        // Opens the Internet Explorer application.
        void OpenApplication(string myFavoritesPath)
        {
            // Start Internet Explorer. Defaults to the home page.
            Process.Start("IExplore.exe");

            // Display the contents of the favorites folder in the browser.
            Process.Start(myFavoritesPath);
        }
        
        // Opens urls and .html documents using Internet Explorer.
        void OpenWithArguments()
        {
            // url's are not considered documents. They can only be opened
            // by passing them as arguments.
            Process.Start("IExplore.exe", "www.northwindtraders.com");

            // 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");
        }

        // Uses the ProcessStartInfo class to start new processes,
        // both in a minimized mode.
        void OpenWithStartInfo()
        {
            ProcessStartInfo startInfo = new ProcessStartInfo("IExplore.exe");
            startInfo.WindowStyle = ProcessWindowStyle.Minimized;

            Process.Start(startInfo);

            startInfo.Arguments = "www.northwindtraders.com";

            Process.Start(startInfo);
        }

        static void Main()
        {
            // Get the path that stores favorite links.
            string myFavoritesPath =
                Environment.GetFolderPath(Environment.SpecialFolder.Favorites);

            MyProcess myProcess = new MyProcess();

            myProcess.OpenApplication(myFavoritesPath);
            myProcess.OpenWithArguments();
            myProcess.OpenWithStartInfo();
        }
    }
}
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.
            Process.Start("IExplore.exe")

            ' Display the contents of the favorites folder in the browser.
            Process.Start(myFavoritesPath)
        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", "www.northwindtraders.com")

            ' 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

            Process.Start(startInfo)

            startInfo.Arguments = "www.northwindtraders.com"

            Process.Start(startInfo)
        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()

            myProcess.OpenApplication(myFavoritesPath)
            myProcess.OpenWithArguments()
            myProcess.OpenWithStartInfo()
        End Sub 'Main
    End Class 'MyProcess
End Namespace 'MyProcessSample

The following F# example defines a runProc function that starts a process, captures all output and error information, and records the number of milliseconds that the process has run. The runProc function has three parameters: the name of application to launch, the arguments to supply to the application, and the starting directory.

open System
open System.Diagnostics

let runProc filename args startDir : seq<string> * seq<string> = 
    let timer = Stopwatch.StartNew()
    let procStartInfo = 
        ProcessStartInfo(
            RedirectStandardOutput = true,
            RedirectStandardError = true,
            UseShellExecute = false,
            FileName = filename,
            Arguments = args
        )
    match startDir with | Some d -> procStartInfo.WorkingDirectory <- d | _ -> ()

    let outputs = System.Collections.Generic.List<string>()
    let errors = System.Collections.Generic.List<string>()
    let outputHandler f (_sender:obj) (args:DataReceivedEventArgs) = f args.Data
    use p = new Process(StartInfo = procStartInfo)
    p.OutputDataReceived.AddHandler(DataReceivedEventHandler (outputHandler outputs.Add))
    p.ErrorDataReceived.AddHandler(DataReceivedEventHandler (outputHandler errors.Add))
    let started = 
        try
            p.Start()
        with | ex ->
            ex.Data.Add("filename", filename)
            reraise()
    if not started then
        failwithf "Failed to start process %s" filename
    printfn "Started %s with pid %i" p.ProcessName p.Id
    p.BeginOutputReadLine()
    p.BeginErrorReadLine()
    p.WaitForExit()
    timer.Stop()
    printfn "Finished %s after %A milliseconds" filename timer.ElapsedMilliseconds
    let cleanOut l = l |> Seq.filter (fun o -> String.IsNullOrEmpty o |> not)
    cleanOut outputs,cleanOut errors

The code for the runProc function was written by ImaginaryDevelopment and is available under the Microsoft Public License.

Remarks

A Process component provides access to a process that is running on a computer. A process, in the simplest terms, is a running app. 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 apps. You can use the Process component, to 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.

This type implements the IDisposable interface. When you have finished using the type, you should dispose of it either directly or indirectly. To dispose of the type directly, call its Dispose method in a try/finally block. To dispose of it indirectly, use a language construct such as using (in C#) or Using (in Visual Basic). For more information, see the "Using an Object that Implements IDisposable" section in the IDisposable interface topic.

Note

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. A 64-bit process, on the other hand, can access the modules of a 32-bit process.

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.

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.

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.

Note

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.

.NET Core Notes

In the .NET Framework, the Process class by default uses Console encodings, which are typically code page encodings, for the input, output, and error streams. For example code, on systems whose culture is English (United States), code page 437 is the default encoding for the Console class. However, .NET Core may make only a limited subset of these encodings available. If this is the case, it uses Encoding.UTF8 as the default encoding.

If a Process object depends on specific code page encodings, you can still make them available by doing the following before you call any Process methods:

  1. Add a reference to the System.Text.Encoding.CodePages.dll assembly to your project.

  2. Retrieve the EncodingProvider object from the CodePagesEncodingProvider.Instance property.

  3. Pass the EncodingProvider object to the Encoding.RegisterProvider method to make the additional encodings supported by the encoding provider available.

The Process class will then automatically use the default system encoding rather than UTF8, provided that you have registered the encoding provider before calling any Process methods.

Constructors

Process() Process() Process() Process()

Initializes a new instance of the Process class.

Properties

BasePriority BasePriority BasePriority BasePriority

Gets the base priority of the associated process.

CanRaiseEvents CanRaiseEvents CanRaiseEvents CanRaiseEvents

Gets a value indicating whether the component can raise an event.

(Inherited from Component)
Container Container Container Container

Gets the IContainer that contains the Component.

(Inherited from Component)
DesignMode DesignMode DesignMode DesignMode

Gets a value that indicates whether the Component is currently in design mode.

(Inherited from Component)
EnableRaisingEvents EnableRaisingEvents EnableRaisingEvents EnableRaisingEvents

Gets or sets whether the Exited event should be raised when the process terminates.

Events Events Events Events

Gets the list of event handlers that are attached to this Component.

(Inherited from Component)
ExitCode ExitCode ExitCode ExitCode

Gets the value that the associated process specified when it terminated.

ExitTime ExitTime ExitTime ExitTime

Gets the time that the associated process exited.

Handle Handle Handle Handle

Gets the native handle of the associated process.

HandleCount HandleCount HandleCount HandleCount

Gets the number of handles opened by the process.

HasExited HasExited HasExited HasExited

Gets a value indicating whether the associated process has been terminated.

Id Id Id Id

Gets the unique identifier for the associated process.

MachineName MachineName MachineName MachineName

Gets the name of the computer the associated process is running on.

MainModule MainModule MainModule MainModule

Gets the main module for the associated process.

MainWindowHandle MainWindowHandle MainWindowHandle MainWindowHandle

Gets the window handle of the main window of the associated process.

MainWindowTitle MainWindowTitle MainWindowTitle MainWindowTitle

Gets the caption of the main window of the process.

MaxWorkingSet MaxWorkingSet MaxWorkingSet MaxWorkingSet

Gets or sets the maximum allowable working set size, in bytes, for the associated process.

MinWorkingSet MinWorkingSet MinWorkingSet MinWorkingSet

Gets or sets the minimum allowable working set size, in bytes, for the associated process.

Modules Modules Modules Modules

Gets the modules that have been loaded by the associated process.

NonpagedSystemMemorySize NonpagedSystemMemorySize NonpagedSystemMemorySize NonpagedSystemMemorySize

Gets the amount of nonpaged system memory, in bytes, allocated for the associated process.

NonpagedSystemMemorySize64 NonpagedSystemMemorySize64 NonpagedSystemMemorySize64 NonpagedSystemMemorySize64

Gets the amount of nonpaged system memory, in bytes, allocated for the associated process.

PagedMemorySize PagedMemorySize PagedMemorySize PagedMemorySize

Gets the amount of paged memory, in bytes, allocated for the associated process.

PagedMemorySize64 PagedMemorySize64 PagedMemorySize64 PagedMemorySize64

Gets the amount of paged memory, in bytes, allocated for the associated process.

PagedSystemMemorySize PagedSystemMemorySize PagedSystemMemorySize PagedSystemMemorySize

Gets the amount of pageable system memory, in bytes, allocated for the associated process.

PagedSystemMemorySize64 PagedSystemMemorySize64 PagedSystemMemorySize64 PagedSystemMemorySize64

Gets the amount of pageable system memory, in bytes, allocated for the associated process.

PeakPagedMemorySize PeakPagedMemorySize PeakPagedMemorySize PeakPagedMemorySize

Gets the maximum amount of memory in the virtual memory paging file, in bytes, used by the associated process.

PeakPagedMemorySize64 PeakPagedMemorySize64 PeakPagedMemorySize64 PeakPagedMemorySize64

Gets the maximum amount of memory in the virtual memory paging file, in bytes, used by the associated process.

PeakVirtualMemorySize PeakVirtualMemorySize PeakVirtualMemorySize PeakVirtualMemorySize

Gets the maximum amount of virtual memory, in bytes, used by the associated process.

PeakVirtualMemorySize64 PeakVirtualMemorySize64 PeakVirtualMemorySize64 PeakVirtualMemorySize64

Gets the maximum amount of virtual memory, in bytes, used by the associated process.

PeakWorkingSet PeakWorkingSet PeakWorkingSet PeakWorkingSet

Gets the peak working set size for the associated process, in bytes.

PeakWorkingSet64 PeakWorkingSet64 PeakWorkingSet64 PeakWorkingSet64

Gets the maximum amount of physical memory, in bytes, used by the associated process.

PriorityBoostEnabled PriorityBoostEnabled PriorityBoostEnabled PriorityBoostEnabled

Gets or sets a value indicating whether the associated process priority should temporarily be boosted by the operating system when the main window has the focus.

PriorityClass PriorityClass PriorityClass PriorityClass

Gets or sets the overall priority category for the associated process.

PrivateMemorySize PrivateMemorySize PrivateMemorySize PrivateMemorySize

Gets the amount of private memory, in bytes, allocated for the associated process.

PrivateMemorySize64 PrivateMemorySize64 PrivateMemorySize64 PrivateMemorySize64

Gets the amount of private memory, in bytes, allocated for the associated process.

PrivilegedProcessorTime PrivilegedProcessorTime PrivilegedProcessorTime PrivilegedProcessorTime

Gets the privileged processor time for this process.

ProcessName ProcessName ProcessName ProcessName

Gets the name of the process.

ProcessorAffinity ProcessorAffinity ProcessorAffinity ProcessorAffinity

Gets or sets the processors on which the threads in this process can be scheduled to run.

Responding Responding Responding Responding

Gets a value indicating whether the user interface of the process is responding.

SafeHandle SafeHandle SafeHandle SafeHandle

Gets the native handle to this process.

SessionId SessionId SessionId SessionId

Gets the Terminal Services session identifier for the associated process.

Site Site Site Site

Gets or sets the ISite of the Component.

(Inherited from Component)
StandardError StandardError StandardError StandardError

Gets a stream used to read the error output of the application.

StandardInput StandardInput StandardInput StandardInput

Gets a stream used to write the input of the application.

StandardOutput StandardOutput StandardOutput StandardOutput

Gets a stream used to read the textual output of the application.

StartInfo StartInfo StartInfo StartInfo

Gets or sets the properties to pass to the Start() method of the Process.

StartTime StartTime StartTime StartTime

Gets the time that the associated process was started.

SynchronizingObject SynchronizingObject SynchronizingObject SynchronizingObject

Gets or sets the object used to marshal the event handler calls that are issued as a result of a process exit event.

Threads Threads Threads Threads

Gets the set of threads that are running in the associated process.

TotalProcessorTime TotalProcessorTime TotalProcessorTime TotalProcessorTime

Gets the total processor time for this process.

UserProcessorTime UserProcessorTime UserProcessorTime UserProcessorTime

Gets the user processor time for this process.

VirtualMemorySize VirtualMemorySize VirtualMemorySize VirtualMemorySize

Gets the size of the process's virtual memory, in bytes.

VirtualMemorySize64 VirtualMemorySize64 VirtualMemorySize64 VirtualMemorySize64

Gets the amount of the virtual memory, in bytes, allocated for the associated process.

WorkingSet WorkingSet WorkingSet WorkingSet

Gets the associated process's physical memory usage, in bytes.

WorkingSet64 WorkingSet64 WorkingSet64 WorkingSet64

Gets the amount of physical memory, in bytes, allocated for the associated process.

Methods

BeginErrorReadLine() BeginErrorReadLine() BeginErrorReadLine() BeginErrorReadLine()

Begins asynchronous read operations on the redirected StandardError stream of the application.

BeginOutputReadLine() BeginOutputReadLine() BeginOutputReadLine() BeginOutputReadLine()

Begins asynchronous read operations on the redirected StandardOutput stream of the application.

CancelErrorRead() CancelErrorRead() CancelErrorRead() CancelErrorRead()

Cancels the asynchronous read operation on the redirected StandardError stream of an application.

CancelOutputRead() CancelOutputRead() CancelOutputRead() CancelOutputRead()

Cancels the asynchronous read operation on the redirected StandardOutput stream of an application.

Close() Close() Close() Close()

Frees all the resources that are associated with this component.

CloseMainWindow() CloseMainWindow() CloseMainWindow() CloseMainWindow()

Closes a process that has a user interface by sending a close message to its main window.

CreateObjRef(Type) CreateObjRef(Type) CreateObjRef(Type) CreateObjRef(Type)

Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.

(Inherited from MarshalByRefObject)
Dispose() Dispose() Dispose() Dispose()
Dispose(Boolean) Dispose(Boolean) Dispose(Boolean) Dispose(Boolean)

Release all resources used by this process.

EnterDebugMode() EnterDebugMode() EnterDebugMode() EnterDebugMode()

Puts a Process component in state to interact with operating system processes that run in a special mode by enabling the native property SeDebugPrivilege on the current thread.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetCurrentProcess() GetCurrentProcess() GetCurrentProcess() GetCurrentProcess()

Gets a new Process component and associates it with the currently active process.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetLifetimeService() GetLifetimeService() GetLifetimeService() GetLifetimeService()

Retrieves the current lifetime service object that controls the lifetime policy for this instance.

(Inherited from MarshalByRefObject)
GetProcessById(Int32) GetProcessById(Int32) GetProcessById(Int32) GetProcessById(Int32)

Returns a new Process component, given the identifier of a process on the local computer.

GetProcessById(Int32, String) GetProcessById(Int32, String) GetProcessById(Int32, String) GetProcessById(Int32, String)

Returns a new Process component, given a process identifier and the name of a computer on the network.

GetProcesses() GetProcesses() GetProcesses() GetProcesses()

Creates a new Process component for each process resource on the local computer.

GetProcesses(String) GetProcesses(String) GetProcesses(String) GetProcesses(String)

Creates a new Process component for each process resource on the specified computer.

GetProcessesByName(String) GetProcessesByName(String) GetProcessesByName(String) GetProcessesByName(String)

Creates an array of new Process components and associates them with all the process resources on the local computer that share the specified process name.

GetProcessesByName(String, String) GetProcessesByName(String, String) GetProcessesByName(String, String) GetProcessesByName(String, String)

Creates an array of new Process components and associates them with all the process resources on a remote computer that share the specified process name.

GetService(Type) GetService(Type) GetService(Type) GetService(Type)

Returns an object that represents a service provided by the Component or by its Container.

(Inherited from Component)
GetType() GetType() GetType() GetType()

Gets the Type of the current instance.

(Inherited from Object)
InitializeLifetimeService() InitializeLifetimeService() InitializeLifetimeService() InitializeLifetimeService()

Obtains a lifetime service object to control the lifetime policy for this instance.

(Inherited from MarshalByRefObject)
Kill() Kill() Kill() Kill()

Immediately stops the associated process.

LeaveDebugMode() LeaveDebugMode() LeaveDebugMode() LeaveDebugMode()

Takes a Process component out of the state that lets it interact with operating system processes that run in a special mode.

MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
MemberwiseClone(Boolean) MemberwiseClone(Boolean) MemberwiseClone(Boolean) MemberwiseClone(Boolean)

Creates a shallow copy of the current MarshalByRefObject object.

(Inherited from MarshalByRefObject)
OnExited() OnExited() OnExited() OnExited()

Raises the Exited event.

Refresh() Refresh() Refresh() Refresh()

Discards any information about the associated process that has been cached inside the process component.

Start() Start() Start() Start()

Starts (or reuses) the process resource that is specified by the StartInfo property of this Process component and associates it with the component.

Start(ProcessStartInfo) Start(ProcessStartInfo) Start(ProcessStartInfo) Start(ProcessStartInfo)

Starts the process resource that is specified by the parameter containing process start information (for example, the file name of the process to start) and associates the resource with a new Process component.

Start(String) Start(String) Start(String) Start(String)

Starts a process resource by specifying the name of a document or application file and associates the resource with a new Process component.

Start(String, String) Start(String, String) Start(String, String) Start(String, String)

Starts a process resource by specifying the name of an application and a set of command-line arguments, and associates the resource with a new Process component.

Start(String, String, SecureString, String) Start(String, String, SecureString, String) Start(String, String, SecureString, String) Start(String, String, SecureString, String)

Starts a process resource by specifying the name of an application, a user name, a password, and a domain and associates the resource with a new Process component.

Start(String, String, String, SecureString, String) Start(String, String, String, SecureString, String) Start(String, String, String, SecureString, String) Start(String, String, String, SecureString, String)

Starts a process resource by specifying the name of an application, a set of command-line arguments, a user name, a password, and a domain and associates the resource with a new Process component.

ToString() ToString() ToString() ToString()

Formats the process's name as a string, combined with the parent component type, if applicable.

WaitForExit() WaitForExit() WaitForExit() WaitForExit()

Instructs the Process component to wait indefinitely for the associated process to exit.

WaitForExit(Int32) WaitForExit(Int32) WaitForExit(Int32) WaitForExit(Int32)

Instructs the Process component to wait the specified number of milliseconds for the associated process to exit.

WaitForInputIdle() WaitForInputIdle() WaitForInputIdle() WaitForInputIdle()

Causes the Process component to wait indefinitely for the associated process to enter an idle state. This overload applies only to processes with a user interface and, therefore, a message loop.

WaitForInputIdle(Int32) WaitForInputIdle(Int32) WaitForInputIdle(Int32) WaitForInputIdle(Int32)

Causes the Process component to wait the specified number of milliseconds for the associated process to enter an idle state. This overload applies only to processes with a user interface and, therefore, a message loop.

Events

Disposed Disposed Disposed Disposed

Occurs when the component is disposed by a call to the Dispose() method.

(Inherited from Component)
ErrorDataReceived ErrorDataReceived ErrorDataReceived ErrorDataReceived

Occurs when an application writes to its redirected StandardError stream.

Exited Exited Exited Exited

Occurs when a process exits.

OutputDataReceived OutputDataReceived OutputDataReceived OutputDataReceived

Occurs each time an application writes a line to its redirected StandardOutput stream.

Security

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.

Applies to

See Also