从vb.net中的命令行获取参数 [英] Get the arguments from a command line in vb.net
本文介绍了从vb.net中的命令行获取参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在此示例中,是否可以从 processPath
返回参数?
这可能更有意义,对不起。
Is it possible to return the arguments from the processPath
in this example?
This might make more sense, sorry.
Dim processName As String
Dim processPath As String
If processName = "cmd" Then
Dim arguments As String() = Environment.GetCommandLineArgs()
Console.WriteLine("GetCommandLineArgs: {0}", String.Join(", ", arguments))
End If
推荐答案
一个简单(干净)的方法是只需按以下方式修改 Sub Main
,
A simple (and clean) way to accomplish this would be to just modify your Sub Main
as follows,
Sub Main(args As String())
' CMD Arguments are contained in the args variable
Console.WriteLine("GetCommandLineArgs: {0}", String.Join(", ", args))
End Sub
这篇关于从vb.net中的命令行获取参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文