Hi theblacksnake, you have to specifiy the parameters. Run cmd then cd to your application then yourApplication.exe -t text1 -s text2. Fernando Soto codes work just fine. Thank you it worked. I tried to make it shows usage-help if there where no arguments. I modified as below: Module Module1 Sub Main Dim clArgs As String = Environment.GetCommandLineArgs Dim type As String = String.Empty Dim speed As String = String.Empty If clArgs.Count = 5 Then For i As Integer = 1 To 3 Step 2 If clArgs(i) = '-t' Then type = clArgs(i + 1) Else speed = clArgs(i + 1) End If Next End If If Not String.IsNullOrEmpty(type) and String.IsNullOrEmpty(speed) Console.WriteLine(type) Console.WriteLine(speed) Console.ReadLine Else Console.WriteLine('usage -t -s') End Sub End Module But I always get the line 'usage -t -s' even if I specify parameters. Hi theblacksnake, you have to specifiy the parameters.
This Function works similar to the Format function in Visual Basic for creating Custom Formating Strings for Date/Time Variables -- Valid characters for the @formatstr Are. -- d Displays the day as a number without a leading zero (1 - 31) -- dd Displays the day as a number with a leading zero (01 - 31). (Visual Basic for Applications) which cannot support the Windows CE runtime environment. VBScript is a programming language that is often viewed as a dialect of VBA (Visual Basic for Applications), although it is really its own language. The VBScript language attempts to balance flexibility, capability and ease of use.
![Vb6 format command list Vb6 format command list](https://www.vbtutor.net/vb2008/Images/vb2008_15_1.gif)
Run cmd then cd to your application then yourApplication.exe -t text1 -s text2. Fernando Soto codes work just fine. Hi theblacksnake; Just use If Else when you check the value of the command line arguments as shown below. If all switches and values are on the command line you will be returned an array with 5 elements. You will need to validate the values to make sure that the user did not reverse the values for the switch. If clArgs.Count = 5 Then For i As Integer = 1 To 3 Step 2 If clArgs(i) = '-t' Then type = clArgs(i + 1) Else speed = clArgs(i + 1) End If Next Else Console.WriteLine('usage -t -s') End If Fernando (MCSD) If a post answers your question, please click ' Mark As Answer' on that post and ' Mark as Helpful'.