Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Passing paramaters to an exe from command line
Message
From
27/01/1999 19:11:16
 
 
To
27/01/1999 19:01:57
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00181105
Message ID:
00181108
Views:
20
>I thought I had read somewhere that you could design your project so that when compiled it would accept parameters from the command line (the names of the files upone which the program is to operate for instance). I have not been able to find it in the help facility. Is there a way to do this?

Yes. The MAIN program for your .EXE should have appropriate LPARAMETER or PARAMETERS statements; if any arguments are passed on the command line, they'll be pulled in as character strings If your main program starts with the line:

LPARAMETERS uVar1, uVar2, uVar3

then up to three command line parameters could be accepted by the program - if there are fewer command line parameters specified, the 'excess' parameters will be set to logical .F.

If you need to pass a command line parameter that includes embedded delimiters like spaces, enclose it in double quotes (") on the commmand line. if your app has the LPARAMETERS statement above, and you start the app with the command:

MyApp Today Is Wednesday

UVar1 will be set to "Today", uVar2 to "Is" and uVar3 to "Wednesday", while if you start it with

MyApp "Today Is Wednesday"

uVar1 will be set to "Today Is Wednesday", and uVar2 and uVar3 will be logical .F.

You can only pass character strings on the command line. To pass a number or date, you'll have to invoke VFP functions like VAL() and CTOD() to convert them for you.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform