本文整理匯總了VB.NET中System.Diagnostics.ProcessStartInfo.Arguments屬性的典型用法代碼示例。如果您正苦於以下問題:VB.NET ProcessStartInfo.Arguments屬性的具體用法?VB.NET ProcessStartInfo.Arguments怎麽用?VB.NET ProcessStartInfo.Arguments使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類System.Diagnostics.ProcessStartInfo
的用法示例。
在下文中一共展示了ProcessStartInfo.Arguments屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: Main
' Place this code into a console project called ArgsEcho to build the argsecho.exe target
Module Module1
Sub Main()
Dim i As Integer = 0
For Each s As String In My.Application.CommandLineArgs
Console.WriteLine($"[{i}] = {s}")
i = i + 1
Next
Console.WriteLine(Environment.NewLine + "Press any key to exit")
Console.ReadLine()
End Sub
End Module
示例2: Module1
' Place this code into a console project called StartArgsEcho. It depends on the
' console application named argsecho.exe.
Module Module1
Sub Main()
Dim startInfo As ProcessStartInfo = 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.
' 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.
' [0] = /a
' [1] = /b:"quoted string"
startInfo.Arguments = "/a /b:""""""quoted string"""""" "
Process.Start(startInfo)
End Sub
End Module