Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Run a WHS script form VFP
Message
 
To
12/09/2000 12:04:18
Steve Buttress
Steve Buttress Software Consulting
Bloomington, California, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00415433
Message ID:
00415438
Views:
17
>I am trying to run a Windows script from VFP, and it works fine, except I can't seem to get the script to use the parameter I pass it. I haven't used the scripting engoine before, but the syntax seems to be:
>
>run /n4 wscript.exe myscript.vbs
>
>I tried adding a parameter as:
>
>run /n4 wscript.exe myscript.vbs "c:\mypath"
>
>The script runs without error, but the path isn't used. I did DIM a variable in the script, but can't see anyway to identify the varible with an incoming parameter.
>
>What I want to do is send a path to he script by way of a variable. The sample code uses the %winddir% example, but "windir" is a known location. I need to send the path to my APP. Can this be done, and if so how?
>
>Thanks,

Steve,

Yes, it can be done. You need to use the WScript.Arguments collection. For example,
Dim cPath, args
Set args = WScript.Arguments
cPath = args(0)
Just one question, why not use the WScript.Shell object to run the script file? That way you only have to pass the fully qualified name of the script file. You can optionally pass the window and and make the caller wait for the script to complete.
George

Ubi caritas et amor, deus ibi est
Previous
Reply
Map
View

Click here to load this message in the networking platform