问题
I have a windows forms based application made by another programmer and I need to add a few command line switches to it's primary output exe
so that I can pass arguments like:
program.exe -reinitialise
or program.exe -sync
I have found some docs online but all seem to be in C# and are for command line only programs.
This program installs via an .msi and the .exe is only constructed at the end.
So my questions are:
How do I add command line switches to a VB.Net application?
Where/What form do I add the parser to so that the primary output .exe accepts the args?
回答1:
Similar to C/C#, you get them as an array. Different from C/C#, you obtain them as a read-only property from the application itself (My.Application.CommandlineArgs)
http://msdn.microsoft.com/en-us/library/z2d603cy(v=vs.80).aspx#Y550
Code sample on that page (for VB) should show you what you need i think...
来源:https://stackoverflow.com/questions/7218217/adding-command-line-arguments-to-vb-net-application