You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: xml/System.Diagnostics/ProcessStartInfo.xml
+30-7Lines changed: 30 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -237,7 +237,24 @@
237
237
<summary>Gets a collection of command-line arguments to use when starting the application.</summary>
238
238
<value>A collection of command-line arguments.</value>
239
239
<remarks>
240
-
<formattype="text/markdown"><![CDATA[If you use this property to set command-line arguments, <xref:System.Diagnostics.ProcessStartInfo.Arguments> must be set to an empty string.
240
+
<formattype="text/markdown"><![CDATA[
241
+
242
+
`ArgumentList`, which is supported starting with .NET Core 2.1 and .NET Standard 2.1, and the <xref:System.Diagnostics.ProcessStartInfo.Arguments> property are independent of one another. That is, the strings assigned to the `ArgumentList` collection are not used to populate the <xref:System.Diagnostics.ProcessStartInfo.Arguments> property, and the string assigned to the <xref:System.Diagnostics.ProcessStartInfo.Arguments> property is not parsed into individual strings that are assigned to `ArgumentList` collection.
243
+
244
+
`ArgumentList` is easier to use than the <xref:System.Diagnostics.ProcessStartInfo.Arguments> property. Because each string is assigned to a member of the collection, you can single- rather than triple-escape strings that are delimited by quotation marks. For example, the following example include `-full "Mary Smith"` as a member of the `ArgumentList` collection:
245
+
246
+
```csharp
247
+
info.ArgumentList.Add("-full \"Mary Smith\"";
248
+
```
249
+
250
+
The corresponding assignment to the <xref:System.Diagnostics.ProcessStartInfo.Arguments> property is:
251
+
252
+
```csharp
253
+
info.Arguments = "-full \"\"\"Mary Smith\"\"\""
254
+
```
255
+
256
+
If you use this property to set command-line arguments, <xref:System.Diagnostics.ProcessStartInfo.Arguments> must be set to an empty string.
257
+
241
258
## Examples
242
259
243
260
This example adds two arguments to the process start info.
<summary>Gets or sets the set of command-line arguments to use when starting the application.</summary>
325
-
<value>A single string containing the arguments to pass to the target application specified in the <seecref="P:System.Diagnostics.ProcessStartInfo.FileName" /> property. The default is an empty string (""). On Windows Vista and earlier versions of the Windows operating system, the length of the arguments added to the length of the full path to the process must be less than 2080. On Windows 7 and later versions, the length must be less than 32699.
326
-
327
-
Arguments are parsed and interpreted by the target application, so must align with the expectations of that application. For.NET applications as demonstrated in the Examples below, spaces are interpreted as a separator between multiple arguments. A single argument that includes spaces must be surrounded by quotation marks, but those quotation marks are not carried through to the target application. In include quotation marks in the final parsed argument, triple-escape each mark.</value>
342
+
<value>A single string containing the arguments to pass to the target application specified in the <seecref="P:System.Diagnostics.ProcessStartInfo.FileName" /> property. The default is an empty string ("").
343
+
</value>
328
344
<remarks>
329
-
<formattype="text/markdown"><![CDATA[If you use this property to set command-line arguments, <xref:System.Diagnostics.ProcessStartInfo.ArgumentList*> must not contain any elements.
345
+
<formattype="text/markdown"><![CDATA[
346
+
347
+
The length of the string assigned to the `Arguments` property must be less than 32,699.
348
+
349
+
Arguments are parsed and interpreted by the target application, so must align with the expectations of that application. For .NET applications as demonstrated in the Examples below, spaces are interpreted as a separator between multiple arguments. A single argument that includes spaces must be surrounded by quotation marks, but those quotation marks are not carried through to the target application. To include quotation marks in the final parsed argument, triple-escape each mark.
350
+
If you use this property to set command-line arguments, <xref:System.Diagnostics.ProcessStartInfo.ArgumentList> must not contain any elements.
330
351
352
+
`Arguments` and <xref:System.Diagnostics.ProcessStartInfo.ArgumentList>, which is supported starting with .NET Core 2.1 and .NET Standard 2.1, are independent of one another. That is, the string assigned to the `Arguments` property does not populate the <xref:System.Diagnostics.ProcessStartInfo.ArgumentList> collection, and the members of the <xref:System.Diagnostics.ProcessStartInfo.ArgumentList> collection are not assigned to the `Arguments` property.
353
+
331
354
## Examples
332
-
The first example below creates a small application (argsecho.exe) that echos its arguments to the console. The second example creates an application that invokes argsecho.exe to demonstrate different variations for the Arguments property.
355
+
The first example creates a small application (argsecho.exe) that echos its arguments to the console. The second example creates an application that invokes argsecho.exe to demonstrate different variations for the `Arguments` property.
0 commit comments