How to make a .exe programme which can using parameter like /u or -u just like format /q.

I have a program I wish to transfer parameters to it before I run it. So I'd like to run exe file with /parameter.
How to do that?

Who is Participating?
Guy Hengel [angelIII / a3]Connect With a Mentor Billing EngineerCommented:
in the program code, check for the value of Command$. This returns the parameters given to your application. So if you run this command: "yourapp.exe -u", command will give "-u".
To debug, you can use the Project Properties->Make->Command line argument. The values of this box will be passed to your app during debug (not when compiled)...


yes, surely! You can do it this way!

Private Sub Command1_Click()
'here adodc1.Recordset.fields("id") is a value got at runtime

Call Shell("//MyWebRoot/c/project/Mydir/MyexePath.exe " & Adodc1.Recordset.Fields("id"), vbNormalFocus)

End sub

You can also pass more than 1 parameter by concatenating the values similar to the above example

Hope this helps!


true, but if you have more than 1 parameter, you can do it this way:

Sub Main() 'start up in form properties
Dim str As String
Dim iCounter As Integer
Dim arr() As String

str = Command 'parameters passed at runtime
arr = Split(str, ",")

 For iCounter = LBound(arr) To UBound(arr)
     X = arr(iCounter)

msgbox arr(0)
msgbox arr(1)
msgbox arr(2) 'load and show the form which you wish to show

End sub


David777Author Commented:
so thanks , angellll, for your so kindly help so many times. I'll debug now and I think it's no problem.

thank you again.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.