Export (0) Print
Expand All

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

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

public static Process Start(
	string fileName,
	string arguments,
	string userName,
	SecureString password,
	string domain
)

Parameters

fileName
Type: System.String

The name of an application file to run in the process.

arguments
Type: System.String

Command-line arguments to pass when starting the process.

userName
Type: System.String

The user name to use when starting the process.

password
Type: System.Security.SecureString

A SecureString that contains the password to use when starting the process.

domain
Type: System.String

The domain to use when starting the process.

Return Value

Type: System.Diagnostics.Process
A new Process component that is associated with the process resource, or null if no process resource is started (for example, if an existing process is reused).

ExceptionCondition
InvalidOperationException

No file name was specified.

Win32Exception

fileName is not an executable (.exe) file.

Win32Exception

An error occurred when opening the associated file.

-or-

The sum of the length of the arguments and the length of the full path to the associated file exceeds 2080. The error message associated with this exception can be one of the following: "The data area passed to a system call is too small." or "Access is denied."

ObjectDisposedException

The process object has already been disposed.

Use this overload to create a new process and its primary thread by specifying its file name, command-line arguments, user name, password, and domain. The new process then runs the specified executable file in the security context of the specified credentials (user, domain, and password).

NoteNote

When the executable file is located on a remote drive, you must identify the network share by using a uniform resource identifier (URI), not a linked drive letter.

NoteNote

If the address of the executable file to start is a URL, the process is not started and null is returned.

The overload associates the resource with a new Process component. If the process is already running, no additional process resource is started. Instead, the existing process resource is reused and no new Process component is created. In such a case, instead of returning a new Process component, Start returns null to the calling procedure.

This overload lets you start a process without first creating a new Process instance. The overload is an alternative to the explicit steps of creating a new Process instance, setting the FileName, Arguments, UserName, Password, and Domain properties of the StartInfo property, and calling Start for the Process instance.

Similarly, in the same way that the Run dialog box can accept an executable file name with or without the .exe extension, the .exe extension is optional in the fileName parameter. For example, you can set the fileName parameter to either "Notepad.exe" or "Notepad". If the fileName parameter represents an executable file, the arguments parameter might represent a file to act upon, such as the text file in Notepad.exe myfile.txt.

NoteNote

The file name must represent an executable file in the Start overloads that have userName, password, and domain parameters.

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

  • LinkDemand 

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

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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

Show:
© 2014 Microsoft