Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Passing a command line switch to an application?
Message
From
23/07/2001 18:34:18
 
 
To
23/07/2001 18:10:59
Thomas Ianuzzi
Information Security Consultants, Inc.
Florida, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00534142
Message ID:
00534156
Views:
14
>I have produced an executalbe and would like to pass it a file name in the command line such as
>
>run myexecutable.exe /filename.txt

Is your executable a VFP executable or non-VFP?

If VFP and you're starting it from the command window or a shortcut, you can issue
myexecutable filename.txt
and the parameter filename.txt will appear in the VFP executable as a character parameter. The first line of your VFP's main executable must be LPARAMETERS or PARAMETERS.

If VFP and you're calling it from another VFP application, simply
DO MyExecutable WITH "filename.txt"
You can pass parameters of any type this way. Here your VFP executable must start with LPARAMETERS or PARAMETERS again.

If non-VFP and you're trying to call it from within VFP, your executable must be set to receive the parameter. Your existing call should work; you could try it without the / before the filename. You can also look at ShellExecute and/or Ed Rauh's API_APPRUN available here for download.
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Previous
Reply
Map
View

Click here to load this message in the networking platform