?
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
Medium Priority
?
135 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 2

Expert Comment

by:priya_pbk
ID: 7153570
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 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 200 total points
ID: 7153573
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
ID: 7153585
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
ID: 7153640
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

Introducing Priority Question

Increase expert visibility of your issues by participating in Priority Question, our latest feature for Premium and Team Account holders. Adjust the priority of your question to get emergent issues in front of subject-matter experts for help when you need it most.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

770 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