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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run exe on a different server thru Shell

Status
Not open for further replies.

itchyII

MIS
Apr 10, 2001
167
Hi Everyone,
I am in the process of automating an existing Access (2000) application. There is a series of about 50 queries that must be run in sequence, then an export of some data, a few FoxPro exe's that are run on the exported data, then a re-import of the data and a few more queries to run. My role is to simply automate the process, not really change anything. In any case, all is going well so far, but I ran into a problem when I try to execute the FoxPro exe's thru a shell. I did a whole lot of research on how to run the exe's in sequence (there are 2), so that the first one completes before the second one starts. Here is what I have so far:

Code:
Dim flag As Boolean
Dim path As String
Dim file As String
Dim test As Long
Dim WSH As IWshShell
Dim WaitForTerm As Boolean
Dim CommandLine As String

Set WSH = New IWshShell_Class
WaitForTerm = True
flag = False

path = "Z:/"
file = "etc_apwithpo.exe"

CommandLine = path & file

On Error GoTo cleanup
test = WSH.Run(CommandLine, vbHide, WaitForTerm)
flag = True

cleanup:
Set WSH = Nothing
runEtc_apwithpo = flag

The problem seems to be that the exe is on another server and if I map the drive on my pc and run it as above, it works no problem. But if I try to pass the absolute path (\\servername\foldername\filename.exe) I get an error (the system cannot find the specified file). I assume this is because the process that I am using to run the file uses the command line and the absolute path is not being accepted. Also, the server is a windows server and there are spaces in the folder name. Does anyone have any ideas on how I can make this work? This app may be distributed to multple users, and that would mean that I would have to worry about everyone's different mapped drives!

Thanks

ItchyII
 
there are spaces in the folder name
Have you tried this ?
test = WSH.Run(Chr(34) & CommandLine & Chr(34), vbHide, WaitForTerm

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Oops, missing closing parenthese ...
there are spaces in the folder name
Have you tried this ?
test = WSH.Run(Chr(34) & CommandLine & Chr(34), vbHide, WaitForTerm)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thanks PHV! I hate it when the answer is so simple! But we learn simple things every day....

ItchyII
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top