16 [HostProtection(
SecurityAction.LinkDemand, SharedState =
true, SelfAffectingProcessMgmt =
true)]
19 private string fileName;
21 private string arguments;
23 private string directory;
29 private bool errorDialog;
31 private IntPtr errorDialogParentHandle;
33 private bool useShellExecute =
true;
35 private string userName;
37 private string domain;
41 private string passwordInClearText;
43 private bool loadUserProfile;
45 private bool redirectStandardInput;
47 private bool redirectStandardOutput;
49 private bool redirectStandardError;
51 private Encoding standardOutputEncoding;
53 private Encoding standardErrorEncoding;
55 private bool createNoWindow;
66 [
TypeConverter(
"System.Diagnostics.Design.VerbConverter, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
67 [MonitoringDescription(
"ProcessVerb")]
68 [NotifyParentProperty(
true)]
88 [MonitoringDescription(
"ProcessArguments")]
89 [SettingsBindable(
true)]
90 [
TypeConverter(
"System.Diagnostics.Design.StringValueConverter, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
91 [NotifyParentProperty(
true)]
96 if (arguments ==
null)
111 [DefaultValue(
false)]
112 [MonitoringDescription(
"ProcessCreateNoWindow")]
113 [NotifyParentProperty(
true)]
118 return createNoWindow;
122 createNoWindow = value;
128 [Editor(
"System.Diagnostics.Design.StringDictionaryEditor, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a",
"System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
131 [MonitoringDescription(
"ProcessEnvironmentVariables")]
132 [NotifyParentProperty(
true)]
137 if (environmentVariables ==
null)
139 environmentVariables =
new StringDictionaryWithComparer();
140 if (weakParentProcess ==
null || !weakParentProcess.IsAlive || ((
Component)weakParentProcess.Target).Site ==
null || !((
Component)weakParentProcess.Target).Site.DesignMode)
144 environmentVariables.
Add((
string)environmentVariable.
Key, (
string)environmentVariable.
Value);
148 return environmentVariables;
156 [NotifyParentProperty(
true)]
161 if (environment ==
null)
172 [DefaultValue(
false)]
173 [MonitoringDescription(
"ProcessRedirectStandardInput")]
174 [NotifyParentProperty(
true)]
179 return redirectStandardInput;
183 redirectStandardInput = value;
190 [DefaultValue(
false)]
191 [MonitoringDescription(
"ProcessRedirectStandardOutput")]
192 [NotifyParentProperty(
true)]
197 return redirectStandardOutput;
201 redirectStandardOutput = value;
208 [DefaultValue(
false)]
209 [MonitoringDescription(
"ProcessRedirectStandardError")]
210 [NotifyParentProperty(
true)]
215 return redirectStandardError;
219 redirectStandardError = value;
229 return standardErrorEncoding;
233 standardErrorEncoding = value;
243 return standardOutputEncoding;
247 standardOutputEncoding = value;
255 [MonitoringDescription(
"ProcessUseShellExecute")]
256 [NotifyParentProperty(
true)]
261 return useShellExecute;
265 useShellExecute = value;
273 public string[]
Verbs 278 RegistryKey registryKey =
null;
282 if (extension !=
null && extension.Length > 0)
284 registryKey = Registry.ClassesRoot.OpenSubKey(extension);
285 if (registryKey !=
null)
287 string str = (string)registryKey.GetValue(
string.Empty);
289 registryKey = Registry.ClassesRoot.OpenSubKey(str +
"\\shell");
290 if (registryKey !=
null)
292 string[] subKeyNames = registryKey.GetSubKeyNames();
293 for (
int i = 0; i < subKeyNames.Length; i++)
295 if (
string.Compare(subKeyNames[i],
"new",
StringComparison.OrdinalIgnoreCase) != 0)
297 arrayList.
Add(subKeyNames[i]);
308 registryKey?.Close();
310 string[] array =
new string[arrayList.
Count];
311 arrayList.
CopyTo(array, 0);
318 [NotifyParentProperty(
true)]
323 if (userName ==
null)
357 return passwordInClearText;
361 passwordInClearText = value;
367 [NotifyParentProperty(
true)]
387 [NotifyParentProperty(
true)]
392 return loadUserProfile;
396 loadUserProfile = value;
403 [Editor(
"System.Diagnostics.Design.StartFileNameEditor, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a",
"System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
404 [MonitoringDescription(
"ProcessFileName")]
405 [SettingsBindable(
true)]
406 [
TypeConverter(
"System.Diagnostics.Design.StringValueConverter, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
407 [NotifyParentProperty(
true)]
412 if (fileName ==
null)
427 [MonitoringDescription(
"ProcessWorkingDirectory")]
428 [Editor(
"System.Diagnostics.Design.WorkingDirectoryEditor, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a",
"System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
429 [SettingsBindable(
true)]
430 [
TypeConverter(
"System.Diagnostics.Design.StringValueConverter, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
431 [NotifyParentProperty(
true)]
436 if (directory ==
null)
451 [DefaultValue(
false)]
452 [MonitoringDescription(
"ProcessErrorDialog")]
453 [NotifyParentProperty(
true)]
474 return errorDialogParentHandle;
478 errorDialogParentHandle = value;
486 [MonitoringDescription(
"ProcessWindowStyle")]
487 [NotifyParentProperty(
true)]
518 this.fileName = fileName;
526 this.fileName = fileName;
527 this.arguments = arguments;
static string GetExtension(string path)
Returns the extension of the specified path string.
Represents a character encoding.To browse the .NET Framework source code for this type,...
bool LoadUserProfile
Gets or sets a value that indicates whether the Windows user profile is to be loaded from the registr...
string Arguments
Gets or sets the set of command-line arguments to use when starting the application.
StringComparison
Specifies the culture, case, and sort rules to be used by certain overloads of the M:System....
string Verb
Gets or sets the verb to use when opening the application or document specified by the P:System....
virtual void Add(string key, string value)
Adds an entry with the specified key and value into the T:System.Collections.Specialized....
virtual int Count
Gets the number of elements actually contained in the T:System.Collections.ArrayList.
Implements a hash table with the key and the value strongly typed to be strings rather than objects.
Provides a type converter to convert expandable objects to and from various other representations.
ProcessStartInfo(string fileName)
Initializes a new instance of the T:System.Diagnostics.ProcessStartInfo class and specifies a file na...
IntPtr ErrorDialogParentHandle
Gets or sets the window handle to use when an error dialog box is shown for a process that cannot be ...
bool RedirectStandardError
Gets or sets a value that indicates whether the error output of an application is written to the P:Sy...
bool UseShellExecute
Gets or sets a value indicating whether to use the operating system shell to start the process.
static IDictionary GetEnvironmentVariables()
Retrieves all environment variable names and their values from the current process.
ProcessWindowStyle
Specified how a new window should appear when the system starts a process.
Represents a weak reference, which references an object while still allowing that object to be reclai...
Specifies a set of values that are used when you start a process.
The exception thrown when using invalid arguments that are enumerators.
SecurityAction
Specifies the security actions that can be performed using declarative security.
Provides information about, and means to manipulate, the current environment and platform....
static bool IsDefined(Type enumType, object value)
Returns an indication whether a constant with a specified value exists in a specified enumeration.
string UserName
Gets or sets the user name to be used when starting the process.
Represents a collection that can contain many different types of permissions.
ProcessStartInfo()
Initializes a new instance of the T:System.Diagnostics.ProcessStartInfo class without specifying a fi...
Provides the base class for enumerations.
string WorkingDirectory
When the P:System.Diagnostics.ProcessStartInfo.UseShellExecute property is false, gets or sets the wo...
Represents text that should be kept confidential, such as by deleting it from computer memory when no...
string FileName
Gets or sets the application or document to start.
A platform-specific type that is used to represent a pointer or a handle.
bool ErrorDialog
Gets or sets a value indicating whether an error dialog box is displayed to the user if the process c...
Provides access to local and remote processes and enables you to start and stop local system processe...
Provides the base implementation for the T:System.ComponentModel.IComponent interface and enables obj...
bool RedirectStandardOutput
Gets or sets a value that indicates whether the textual output of an application is written to the P:...
virtual void CopyTo(Array array)
Copies the entire T:System.Collections.ArrayList to a compatible one-dimensional T:System....
string []? Verbs
Gets the set of verbs associated with the type of file specified by the P:System.Diagnostics....
bool RedirectStandardInput
Gets or sets a value indicating whether the input for an application is read from the P:System....
bool CreateNoWindow
Gets or sets a value indicating whether to start the process in a new window.
virtual int Add(object value)
Adds an object to the end of the T:System.Collections.ArrayList.
ProcessStartInfo(string fileName, string arguments)
Initializes a new instance of the T:System.Diagnostics.ProcessStartInfo class, specifies an applicati...
string PasswordInClearText
Gets or sets the user password in clear text to use when starting the process.
SecureString Password
Gets or sets a secure string that contains the user password to use when starting the process.
DesignerSerializationVisibility
Specifies the visibility a property has to the design-time serializer.
Encoding StandardOutputEncoding
Gets or sets the preferred encoding for standard output.
object Value
Gets or sets the value in the key/value pair.
object Key
Gets or sets the key in the key/value pair.
ProcessWindowStyle WindowStyle
Gets or sets the window state to use when the process is started.
Encoding StandardErrorEncoding
Gets or sets the preferred encoding for error output.
Defines a dictionary key/value pair that can be set or retrieved.
string Domain
Gets or sets a value that identifies the domain to use when starting the process.
StringDictionary EnvironmentVariables
Gets search paths for files, directories for temporary files, application-specific options,...
Provides a unified way of converting types of values to other types, as well as for accessing standar...
Performs operations on T:System.String instances that contain file or directory path information....
Implements the T:System.Collections.IList interface using an array whose size is dynamically increase...