Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Command line

Status
Not open for further replies.

DarrenWard

IS-IT--Management
Feb 15, 2002
217
GB
I must be missing something, but i cant see a way of passing a command line to my application when compiled, i know you can pass command line switches to VFP but i want my app to read in command line parameters and use them.



GuiltyMaggot - The best rock band in the world!
 
DarrenWard

Do you mean sending a paramater to an exe? If so I created a program with the first line being :
LPARAMETER cText

And second line :
Messagebox(cText)

Compiled into an exe
And used
do myexe.ex with "Hello"


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
I knew it was gonna be something that easy, ever had one of those days Mike?

Maybe going to the pub after work yesterday was a bad idea !

Thanks.

GuiltyMaggot - The best rock band in the world!
 
Darren

Going to the pub after work is never a bad idea. If anything it should be actively encouraged.
 
DarrenWard

Maybe going to the pub after work yesterday was a bad idea !

Bring your laptop just in case. :)



Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Maybe i have stumbled across the next evolution to working from home, and am sure that Intel had that very idea in mind when they came up with Centrino.

Looking at some of my code at times you may be forgiven for thinking thats where i do most of my work anyway, but living in sunny Dorset (England) the English pub garden is sometimes to much of a temptation, even for me.

GuiltyMaggot - The best rock band in the world!
 
Darren

I think you may be on to something here. The idea has immense potential, given that pubs these days are crying over lost trade. Combining the work place, with a traditionally social establishment would therefore lower employers costs, and generate trade in a dwindling market. Surely that is what economics is all about?


WTrueman
...if it works dont mess with it
 
Regarding the initial question, I solution offered does not work when the .EXE is run from the windows command line.

If you want your .EXE to be run with certain switches?? It would be interesting to know.
 
Works for me

past the following into a prg
add to a proj as startup
compile to exe


PARAMETERS cTxt
=MESSAGEBOX(cTxt,0,"Testing")
quit


then drop to command or cmd prompt and type

An additional question slight off topic, can anyone give me short responce to LAPRAMETERS over PARAMETERS


my.exe Testing


Steve Bowman
steve.bowman@ultraex.com

 
Here is an update for the initial question.

You can pass parameters from the command line to an EXE. But you can pass only one parameter; the EXE will accept only one parameter from Command line. If you want to pass more than one put all in one quote seperated by a delimiter. In the application you have to parse it and use.
 
ProgrammerK

You can pass parameters from the command line to an EXE.But you can pass only one parameter;

Here is what the help file says, and it seems to conterdict you:
DO ProgramName1 | ProcedureName [IN ProgramName2] [WITH ParameterList]
WITH ParameterList
Specifies parameters to pass to the program or procedure. The parameters listed in ParameterList can be expressions, memory variables, literals, fields, or user-defined functions. By default, parameters are passed to programs and procedures by reference. You can pass a parameter by value by placing it in parentheses.




Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
I totally misunderstood the question. My suggestion was about DOS. Recently I created a progrm and have to pass 13 parameters. This program need to be called from DOS. When I try to pass these 13 parameters from DOS I had the problem that the EXE is taking all the parameters as a single value.

Sorry about the mis-suggestion.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top