แก้ไข

แชร์ผ่าน


ProcessStartInfo.WorkingDirectory Property

Definition

When the UseShellExecute property is false, gets or sets the working directory for the process to be started. When UseShellExecute is true, gets or sets the directory that contains the process to be started.

public:
 property System::String ^ WorkingDirectory { System::String ^ get(); void set(System::String ^ value); };
public string WorkingDirectory { get; set; }
[System.ComponentModel.TypeConverter("System.Diagnostics.Design.StringValueConverter, System.Design, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
public string WorkingDirectory { get; set; }
[System.ComponentModel.TypeConverter("System.Diagnostics.Design.StringValueConverter, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
public string WorkingDirectory { get; set; }
[System.ComponentModel.SettingsBindable(true)]
[System.ComponentModel.TypeConverter("System.Diagnostics.Design.StringValueConverter, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
public string WorkingDirectory { get; set; }
[System.ComponentModel.SettingsBindable(true)]
public string WorkingDirectory { get; set; }
member this.WorkingDirectory : string with get, set
[<System.ComponentModel.TypeConverter("System.Diagnostics.Design.StringValueConverter, System.Design, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")>]
member this.WorkingDirectory : string with get, set
[<System.ComponentModel.TypeConverter("System.Diagnostics.Design.StringValueConverter, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")>]
member this.WorkingDirectory : string with get, set
[<System.ComponentModel.SettingsBindable(true)>]
[<System.ComponentModel.TypeConverter("System.Diagnostics.Design.StringValueConverter, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")>]
member this.WorkingDirectory : string with get, set
[<System.ComponentModel.SettingsBindable(true)>]
member this.WorkingDirectory : string with get, set
Public Property WorkingDirectory As String

Property Value

When UseShellExecute is true, the fully qualified name of the directory that contains the process to be started. When the UseShellExecute property is false, the working directory for the process to be started. The default is an empty string ("").

Attributes

Remarks

Important

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 directory is already part of the system path variable, you do not have to repeat the directory's location in this property.

The WorkingDirectory property behaves differently when UseShellExecute is true than when UseShellExecute is false. When UseShellExecute is true, the WorkingDirectory property specifies the location of the executable. If WorkingDirectory is an empty string, the current directory is understood to contain the executable.

Note

When UseShellExecute is true, the working directory of the application that starts the executable is also the working directory of the executable.

When UseShellExecute is false, the WorkingDirectory property is not used to find the executable. Instead, its value applies to the process that is started and only has meaning within the context of the new process.

Applies to