ProcessStartInfo.Password 属性

定义

重要

此 API 不符合 CLS。

获取或设置一个安全字符串,其中包含要在启动进程时使用的用户密码。Gets or sets a secure string that contains the user password to use when starting the process.

public:
 property System::Security::SecureString ^ Password { System::Security::SecureString ^ get(); void set(System::Security::SecureString ^ value); };
[System.CLSCompliant(false)]
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
public System.Security.SecureString? Password { get; set; }
[System.CLSCompliant(false)]
public System.Security.SecureString Password { get; set; }
public System.Security.SecureString Password { get; set; }
[<System.CLSCompliant(false)>]
[<System.Runtime.Versioning.SupportedOSPlatform("windows")>]
member this.Password : System.Security.SecureString with get, set
member this.Password : System.Security.SecureString with get, set
[<System.CLSCompliant(false)>]
member this.Password : System.Security.SecureString with get, set
Public Property Password As SecureString

属性值

SecureString

启动进程时使用的用户密码。The user password to use when starting the process.

属性

注解

重要

WorkingDirectory如果 UserName 提供了和,则必须设置属性 PasswordThe WorkingDirectory property must be set if UserName and Password are provided. 如果未设置该属性,则默认工作目录为%Systemroot%\system32If the property is not set, the default working directory is %SYSTEMROOT%\system32.

备注

Domain UserName Password ProcessStartInfo 要使用用户凭据启动进程,建议在对象中设置、和属性。Setting the Domain, UserName, and the Password properties in a ProcessStartInfo object is the recommended practice for starting a process with user credentials.

SecureString对象类似于 String 对象,因为它有一个文本值。A SecureString object is like a String object in that it has a text value. 但是,对象的值 SecureString 是自动加密的,因此可以对其进行修改,直到应用程序将其标记为只读,并可通过应用程序或 .NET Framework 垃圾回收器将其从计算机内存中删除。However, the value of a SecureString object is automatically encrypted, it can be modified until your application marks it as read-only, and it can be deleted from computer memory by either your application or the .NET Framework garbage collector.

有关安全字符串和如何获取用于设置此属性的密码的示例的详细信息,请参见 SecureString 类。For more information about secure strings and an example of how to obtain a password to set this property, see the SecureString class.

备注

如果为属性提供值 Password ,则 UseShellExecute 属性必须为 false ,否则在 InvalidOperationException 调用方法时将引发 Process.Start(ProcessStartInfo)If you provide a value for the Password property, the UseShellExecute property must be false, or an InvalidOperationException will be thrown when the Process.Start(ProcessStartInfo) method is called.

适用于