I like+rep
I will show you how to make a program which reads the Command line arguments from a program, it's pretty easy if you know how to do it
First we declares a ReadOnlyCollection to store the value from our commandline.
The to get them one by one it's just to refer to its index, in the example below a messagebox will pop up with the arguments one by one.Code:Dim CommandLineArgs As System.Collections.ObjectModel.ReadOnlyCollection(Of String) = My.Application.CommandLineArgs
Code:For i As Integer = 0 To CommandLineArgs.Count - 1 MessageBox.Show(CommandLineArgs(i)) Next
This was actually all the code but before publishing you need to remember to uncheck the "use .deploy file extension" checkbox:
Now after publishing you will get the .exe file. If you create a shortcut to this .exe file you can add command line arguments to it as shown in the image below:
Our program can now read these argument and one messagebox showing "Argument1" will be shown and then one showing "Argument2".
That was it. Hope you liked it![]()
I like+rep
CodeCall Blog | CodeCall Wiki
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog
Very thorough! Nice work. +rep
There are currently 1 users browsing this thread. (0 members and 1 guests)