1
在表单加载上,您可以从Environment.CommandLine
检索整个命令字符串。但是,当我使用应用程序事件来检测命令行字符串时,我的单个实例应用程序再次打开,我找不到相当于Environment.CommandLine
在StartupNextInstanceEventArgs
。VB.NET等效于(StartupNextInstanceEventArgs)中的Environment.CommandLine
这里是我的代码:
Private Sub MyApplication_StartupNextInstance(_
ByVal sender As Object, _
ByVal e As Microsoft.VisualBasic.ApplicationServices.StartupNextInstanceEventArgs _
) Handles Me.StartupNextInstance
'I can only use e.CommandLine which returns a readonlycollection, not a string like Environment.CommandLine does. Can someone help me out?
End Sub
只需使用'昏暗CMD =的string.join(””,e.CommandLine.ToArray)' –