ProcessStartInfo 建構函式

定義

初始化 ProcessStartInfo 類別的新執行個體。

多載

ProcessStartInfo()

不指定用來啟動處理序的檔案名稱,初始化 ProcessStartInfo 類別的新執行個體。

ProcessStartInfo(String)

初始化 ProcessStartInfo 類別的新執行個體,並指定用來啟動處理序的檔案名稱 (例如應用程式或文件)。

ProcessStartInfo(String, IEnumerable<String>)
ProcessStartInfo(String, String)

初始化 ProcessStartInfo 類別的新執行個體,並指定用來啟動處理序的應用程式檔案名稱,以及指定要傳遞至應用程式的命令列引數集。

ProcessStartInfo()

來源:
ProcessStartInfo.cs
來源:
ProcessStartInfo.cs
來源:
ProcessStartInfo.cs

不指定用來啟動處理序的檔案名稱,初始化 ProcessStartInfo 類別的新執行個體。

public:
 ProcessStartInfo();
public ProcessStartInfo ();
Public Sub New ()

備註

啟動行程之前,您至少 FileName 必須設定 屬性。 檔名是任何應用程式或檔。 在此情況下,檔會定義為任何具有已開啟或預設動作的檔類型。 您可以使用 [ 資料夾選項 ] 對話框,透過作業系統來檢視已註冊的檔類型及其相關聯的應用程式。 [ 進階 ] 按鈕會導致對話框顯示是否有與特定已註冊檔類型相關聯的開啟動作。

或者,您也可以在啟動程式之前設定其他屬性。 屬性 Verb 會提供動作,例如「print」 ,以及屬性中所指出的 FileName 檔案。 屬性 Arguments 提供方法,以在系統開啟命令行自變數時將命令行自變數傳遞至檔案。

重要

使用此物件的執行個體時,若並用了不信任的資料,會造成安全性上的風險。 使用此物件時,請一律使用信任的資料。 如需詳細資訊,請參閱 驗證所有輸入

適用於

ProcessStartInfo(String)

來源:
ProcessStartInfo.cs
來源:
ProcessStartInfo.cs
來源:
ProcessStartInfo.cs

初始化 ProcessStartInfo 類別的新執行個體,並指定用來啟動處理序的檔案名稱 (例如應用程式或文件)。

public:
 ProcessStartInfo(System::String ^ fileName);
public ProcessStartInfo (string fileName);
new System.Diagnostics.ProcessStartInfo : string -> System.Diagnostics.ProcessStartInfo
Public Sub New (fileName As String)

參數

fileName
String

用來啟動處理序的應用程式或文件。

備註

檔名是任何應用程式或檔。 在此情況下,檔會定義為任何具有已開啟或預設動作的檔類型。 您可以使用 [ 資料夾選項 ] 對話框,透過作業系統來檢視已註冊的檔類型及其相關聯的應用程式。 [ 進階 ] 按鈕會導致對話框顯示是否有與特定已註冊檔類型相關聯的開啟動作。

您可以在呼叫這個建構函式之後變更 FileName 屬性,最多到進程啟動的時間。 啟動程序之後,變更這些值並沒有任何作用。

重要

使用此物件的執行個體時,若並用了不信任的資料,會造成安全性上的風險。 使用此物件時,請一律使用信任的資料。 如需詳細資訊,請參閱 驗證所有輸入

適用於

ProcessStartInfo(String, IEnumerable<String>)

來源:
ProcessStartInfo.cs
來源:
ProcessStartInfo.cs
public:
 ProcessStartInfo(System::String ^ fileName, System::Collections::Generic::IEnumerable<System::String ^> ^ arguments);
public ProcessStartInfo (string fileName, System.Collections.Generic.IEnumerable<string> arguments);
new System.Diagnostics.ProcessStartInfo : string * seq<string> -> System.Diagnostics.ProcessStartInfo
Public Sub New (fileName As String, arguments As IEnumerable(Of String))

參數

fileName
String
arguments
IEnumerable<String>

適用於

ProcessStartInfo(String, String)

來源:
ProcessStartInfo.cs
來源:
ProcessStartInfo.cs
來源:
ProcessStartInfo.cs

初始化 ProcessStartInfo 類別的新執行個體,並指定用來啟動處理序的應用程式檔案名稱,以及指定要傳遞至應用程式的命令列引數集。

public:
 ProcessStartInfo(System::String ^ fileName, System::String ^ arguments);
public ProcessStartInfo (string fileName, string arguments);
new System.Diagnostics.ProcessStartInfo : string * string -> System.Diagnostics.ProcessStartInfo
Public Sub New (fileName As String, arguments As String)

參數

fileName
String

用來啟動處理序的應用程式。

arguments
String

要在處理序啟動時傳遞至應用程式的命令列引數。

備註

檔名是任何應用程式或檔。 在此情況下,檔會定義為任何具有已開啟或預設動作的檔類型。 您可以使用 [ 資料夾選項 ] 對話框,透過作業系統來檢視已註冊的檔類型及其相關聯的應用程式。 [ 進階 ] 按鈕會導致對話框顯示是否有與特定已註冊檔類型相關聯的開啟動作。

您可以在呼叫這個建構函式之後變更 FileNameArguments 屬性,到進程啟動的時間為止。 啟動程序之後,變更這些值並沒有任何作用。

重要

使用此物件的執行個體時,若並用了不信任的資料,會造成安全性上的風險。 使用此物件時,請一律使用信任的資料。 如需詳細資訊,請參閱 驗證所有輸入

適用於