Solved

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

Posted on 2002-07-14
4
129 Views
Last Modified: 2010-05-02
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?

0
Comment
Question by:David777
  • 2
4 Comments
 
LVL 2

Expert Comment

by:priya_pbk
Comment Utility
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!

-priya


0
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 50 total points
Comment Utility
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)...

CHeers

0
 
LVL 2

Expert Comment

by:priya_pbk
Comment Utility
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)
 Next

msgbox arr(0)
msgbox arr(1)
msgbox arr(2)

Form1.show 'load and show the form which you wish to show

End sub

-priya

0
 

Author Comment

by:David777
Comment Utility
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.
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now