本文整理匯總了C#中System.Diagnostics.ProcessStartInfo.Arguments屬性的典型用法代碼示例。如果您正苦於以下問題:C# ProcessStartInfo.Arguments屬性的具體用法?C# ProcessStartInfo.Arguments怎麽用?C# ProcessStartInfo.Arguments使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類System.Diagnostics.ProcessStartInfo
的用法示例。
在下文中一共展示了ProcessStartInfo.Arguments屬性的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Main
// Place this code into a console project called ArgsEcho to build the argsecho.exe target
using System;
namespace StartArgs
{
class ArgsEcho
{
static void Main(string[] args)
{
Console.WriteLine("Received the following arguments:\n");
for (var i = 0; i < args.Length; i++)
{
Console.WriteLine($"[{i}] = {args[i]}");
}
Console.WriteLine("\nPress any key to exit");
Console.ReadLine();
}
}
}
示例2: Main
// Place this code into a console project called StartArgsEcho. It depends on the
// console application named argsecho.exe.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
namespace StartArgsEcho
{
class Program
{
static void Main()
{
ProcessStartInfo startInfo = new ProcessStartInfo("argsecho.exe");
startInfo.WindowStyle = ProcessWindowStyle.Normal;
// Start with one argument.
// Output of ArgsEcho:
// [0]=/a
startInfo.Arguments = "/a";
Process.Start(startInfo);
// Start with multiple arguments separated by spaces.
// Output of ArgsEcho:
// [0] = /a
// [1] = /b
// [2] = c:\temp
startInfo.Arguments = "/a /b c:\\temp";
Process.Start(startInfo);
// An argument with spaces inside quotes is interpreted as multiple arguments.
// Output of ArgsEcho:
// [0] = /a
// [1] = literal string arg
startInfo.Arguments = "/a \"literal string arg\"";
Process.Start(startInfo);
// An argument inside double quotes is interpreted as if the quote weren't there,
// that is, as separate arguments. Equivalent verbatim string is @"/a /b:""string with quotes"""
// Output of ArgsEcho:
// [0] = /a
// [1] = /b:string
// [2] = in
// [3] = double
// [4] = quotes
startInfo.Arguments = "/a /b:\"\"string in double quotes\"\"";
Process.Start(startInfo);
// Triple-escape quotation marks to include the character in the final argument received
// by the target process. Equivalent verbatim string: @"/a /b:""""""quoted string""""""";
// [0] = /a
// [1] = /b:"quoted string"
startInfo.Arguments = "/a /b:\"\"\"quoted string\"\"\"";
Process.Start(startInfo);
}
}
}
示例3: Main
//引入命名空間
using System.Diagnostics;
public class StartingProcesses
{
public static void Main()
{
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = "notepad.exe";
startInfo.Arguments = "process.cs";
Process.Start(startInfo);
}
}