Process.Start Method (String, String, SecureString, String)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

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.

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

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


Type: System.String

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

Type: System.String

The user name to use when starting the process.

Type: System.Security.SecureString

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

Type: System.String

The domain to use when starting the process.

Return Value

Type: System.Diagnostics.Process

A new Process that is associated with the process resource, or null if no process resource is started. Note that a new process that’s started alongside already running instances of the same process will be independent from the others. In addition, Start may return a non-null Process with its HasExited property already set to true. In this case, the started process may have activated an existing instance of itself and then exited.

Exception Condition

No file name was specified.


fileName is not an executable (.exe) file.


There was an error in opening the associated file.


The process object has already been disposed.

Use this overload to create a new process and its primary thread by specifying its file name, 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).


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.


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

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, 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.


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

Whenever you use Start to start a process, you might need to close it or you risk losing system resources. Close processes using CloseMainWindow or Kill. You can check whether a process has already been closed by using its HasExited property..

The following code example shows the use of this overload to start an executable file and also demonstrates the throwing of a Win32Exception when an attempt is made to start an application associated with a nonexecutable file.

// NOTE: This example requires a text.txt file file in your Documents folder
using System;
using System.Diagnostics;
using System.Security;
using System.ComponentModel;

class Example
    static void Main()
        Console.Write("Enter your domain: ");
        string domain = Console.ReadLine();
        Console.Write("Enter you user name: ");
        string uname = Console.ReadLine();
        Console.Write("Enter your password: ");
        SecureString password = new SecureString();
        ConsoleKeyInfo key;
        do {
           key = Console.ReadKey(true);

           // Ignore any key out of range.
           if (((int) key.Key) >= 33 && ((int) key.Key <= 90) && key.Key != ConsoleKey.Enter) {
              // Append the character to the password.
        // Exit if Enter key is pressed.
        } while (key.Key != ConsoleKey.Enter);

        try {
            Console.WriteLine("\nTrying to launch NotePad using your login information...");
            Process.Start("notepad.exe", uname, password, domain);
        catch (Win32Exception ex) {

        string path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\";

        try {
             // The following call to Start succeeds if test.txt exists.
             Console.WriteLine("\nTrying to launch 'text.txt'...");
             Process.Start(path + "text.txt");
        catch (Win32Exception ex) {

        try {
             // Attempting to start in a shell using this Start overload fails. This causes
             // the following exception, which is picked up in the catch block below:
             // The specified executable is not a valid application for this OS platform.
             Console.WriteLine("\nTrying to launch 'text.txt' with your login information...");
             Process.Start(path + "text.txt", uname, password, domain);
         catch (Win32Exception ex)
         finally {


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

.NET Framework
Available since 2.0
Return to top