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?
To set command-line arguments in Visual Studio, right click on the project name, then go to Properties. In the Properties Pane, go to "Debugging", and in this pane is a line for "Command-line arguments." Add the values you would like to use on this line. They will be passed to the program via the argv array.
Right-click on the shortcut and choose Properties. In the target-field add command line parameters after the program file name. For example: %SystemRoot%\system32\notepad.exe C:\test1. txt.
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...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With