2013-02-01 32 views
1

我试图读取传递的参数,
例如:
壳:

如何阅读传递的参数

MyApplication.exe -t 1233123 

所有MyApplication代码:

dim tt as string = GetArgo(0).toString() 

我想要得到的“ 1233123“(我试过Me.Startup,但我没有在我的表单中的Startup事件)

回答

3

你可以通过调用Environment.GetCommandLineArgs得到的参数保持:

Dim args() As String = Environment.GetCommandLineArgs() 

然后你就可以通过查看此数组就像你任何其他阵列。请记住,数组中的第一项是执行程序的文件名。

+0

谢谢。作品。 – sthml