Command函数

王朝百科·作者佚名  2010-02-16  
宽屏版  字体: |||超大  

Visual Basic 语言参考

Command 函数

返回用于启动 Visual Basic 或使用 Visual Basic 开发的可执行程序的命令行的参数部分。

My 功能可以提供比 Command 函数更高的效率和更好的性能。有关更多信息,请参见 My.Application.CommandLineArgs 属性。

Public Function Command() As String

备注

参数返回后,您可以搜索常用分隔符(如空格、反斜杠、正斜杠、连字符或引号)断开或搜索单个参数的字符串。

对于用 Visual Basic 开发的且编译为 .exe 文件的应用程序,Command 函数返回在命令行中出现于应用程序名称后的任何参数,其格式为:MyApp(cmdlineargs)。

示例

此示例使用 Command 函数返回包含数组的对象中的命令行参数。

Visual Basic 复制代码

Function GetCommandLineArgs() As String()

' Declare variables.

Dim separators As String = " "

Dim commands As String = Microsoft.VisualBasic.Interaction.Command()

Dim args() As String = commands.Split(separators.ToCharArray)

Return args

End Function

要求

命名空间: Microsoft.VisualBasic

模块: Interaction

程序集: Visual Basic Runtime Library(在 Microsoft.VisualBasic.dll 中)

 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
© 2005- 王朝百科 版权所有