Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

ProcessStartInfo.UserName Property

Gets or sets the user name to be used when starting the process.

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

public string UserName { get; set; }
/** @property */
public String get_UserName ()

/** @property */
public void set_UserName (String value)

public function get UserName () : String

public function set UserName (value : String)

Not applicable.

Property Value

The user name to use when starting the process.

NoteImportant:

   The WorkingDirectory property must be set if UserName and Password are provided. If the property is not set, the default working directory is %SYSTEMROOT%\system32.

If the UserName property is not a null reference (Nothing in Visual Basic) or an empty string, the UseShellExecute property must be false, or an InvalidOperationException will be thrown when the Process.Start(ProcessStartInfo) method is called.

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

ADD
Show:
© 2015 Microsoft