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

Difference between run and exec

Status
Not open for further replies.

xwb

Programmer
Jul 11, 2002
6,828
GB
Is there some internal difference between run and exec in wshshell? I'm using them with secure shell. The secure shell program takes about 10 minutes to run and then comes back.

When I use run, it reports and end of file error. When I use exec, it runs to completion. The only difference I can see is that with exec, you have control over the I/O but why should it make so much difference to ssh?
 
With EXEC you have the option to wait for execution to complete. With RUN your script will just continue to the next line of code.

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
>With EXEC you have the option to wait for execution to complete. With RUN your script will just continue to the next line of code.
Maybe not quite true. Check out run's 3rd parameter.
 
I am running with 3rd parameter false and waiting for the program to terminate. Problem is that ssh says I've lost the connection when I use run but not when I use exec.

Maybe it is something to do with the synchronous nature of run and asynchronous nature of exec.
 
I don't have any further information to add than what has already been mentioned, but I wonder how you're calling the ssh app exactly??

.Run "sshapp.exe xxxxx"
.Exec "sshapp.exe xxxx"

or

.Run "%comspec% /c sshapp.exe xxxx"
.Exec "%comspec% /c sshapp.exe xxxx"



--------------------------------------------------------------------------------
dm4ever
My philosophy: K.I.S.S - Keep It Simple Stupid
 
Tried it both ways (except I used cmd.exe instead of %comspec%. The result is the same.

I'm now using the exec method but I'd really like to know why ssh loses the connection when I use run.
 
I am running with 3rd parameter false
I'd use True ...

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top