项目作用域命令行参数 [英] Project scoping command line arguments
问题描述
我正在与机器人进行通信的项目中,我需要使用机器人脱机调试代码.
我想根据命令行参数设置一个变量.
如何在Main中设置在整个项目中可见的变量?
在此先感谢您的帮助.
I am working on a project that communicates with robots, I need to debug the code with the robots offline.
I want to set a variable based on command line parameters.
How can I set a variable in Main that is visable throughout the project?
Thanks in advance for your help.
推荐答案
如果使用VB(不是.NET),请参见以下示例:
If VB (not .NET), see this example:
Function Main(ByVal CmdArgs() As String) As Integer
Dim ArgNum As Integer ' Index of individual command-line argument.
If CmdArgs.Length > 0 Then ' See if there are any arguments.
For ArgNum = 0 To UBound(CmdArgs)
' Examine CmdArgs(ArgNum) for settings you need to handle.
Next ArgNum
End If
MsgBox("Hello World!") ' Display message on computer screen.
Return 0 ' Zero usually means successful completion.
End Function
在VB.NET中,从此处开始:如何:访问命令行参数(Visual Basic) [ ^ ]
http://msdn.microsoft.com/en-us/library/3cf7t4xt%28v = vs.71%29.aspx [ ^ ]
其他有用的链接:
http://www.vbdotnetforums.com/console-application/5177-how-parse-command-line-parameters-visual-basic-net.html [ http://en.allexperts.com/q/Visual-Basic-1048/VB6-main-arguments.htm [ ^ ]
http://65.39.148.52/Articles/16096/VB-6-0到VB-NET迁移命令行参数 [如何将命令行参数传递给MSI安装程序自定义操作 [
In VB.NET, start here: How to: Access Command-Line Arguments (Visual Basic) [^]
http://msdn.microsoft.com/en-us/library/3cf7t4xt%28v=vs.71%29.aspx[^]
Other useful links:
http://www.vbdotnetforums.com/console-application/5177-how-parse-command-line-parameters-visual-basic-net.html[^]
http://en.allexperts.com/q/Visual-Basic-1048/VB6-main-arguments.htm[^]
http://65.39.148.52/Articles/16096/VB-6-0-to-VB-NET-Migration-Command-Line-Arguments[^]
How to Pass Command Line Arguments to MSI Installer Custom Actions[^]
这篇关于项目作用域命令行参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!