Adding command line arguments to VB.Net application

妖精的绣舞 提交于 2019-12-30 06:20:09

问题


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:

  1. How do I add command line switches to a VB.Net application?

  2. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!