ProcessStartInfo.Password 屬性

定義

重要

此 API 不符合 CLS 規範。

取得或設定安全字串,其中包含啟動處理序時要使用的使用者密碼。

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
[<System.CLSCompliant(false)>]
member this.Password : System.Security.SecureString with get, set
member this.Password : System.Security.SecureString with get, set
Public Property Password As SecureString

屬性值

要在啟動處理序時使用的使用者密碼。

屬性

備註

重要

如果 UserName 提供 和 PasswordWorkingDirectory 則必須設定 屬性。 如果未設定屬性,預設工作目錄為 %SYSTEMROOT%\system32。

注意

Domain在 物件中 ProcessStartInfo 設定 、 UserNamePassword 屬性是使用使用者認證啟動進程的建議做法。

SecureString物件就像 String 物件,因為它有文字值。 不過,物件的值 SecureString 會自動加密,可以修改,直到您的應用程式將它標示為唯讀,而且應用程式或.NET Framework垃圾收集行程可以從電腦記憶體中刪除。

如需安全字串的詳細資訊,以及如何取得設定此屬性之密碼的範例,請參閱 SecureString 類別。

注意

如果您提供 屬性的值 PasswordUseShellExecute 則屬性必須是 false ,或在 InvalidOperationException 呼叫 方法時 Process.Start(ProcessStartInfo) 擲回 。

適用於