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

Arguement acceptance, shell command

Status
Not open for further replies.

shawnnason

Programmer
Jun 12, 2001
26
US
I have written a VB application that performs registry upgrades. I now want to modify it so that the program can be run remotely. I would like to be able to run, from a remote machine, a VB application that uses the shell "net use" command. I want to allow the remote user to make a few choices, then have the remote app pass those choices along to the local app as parameters that the local app uses. Is there a way for a VB app to accept command line arguments? Also, is there a way to get a return code from a shell command to know if it has completed? Right now I have a delay set up that takes X amount of time, but I don't want to wait X each time if it only takes a second or two. So, Id like to use the return as a trigger to end the delay.

Shawn
 
Yes, and Yes.

To retrieve the command line:
msgbox Command

To set up a command line while still developing your app, go to Project properties, select the Make tab, and fill in Command Line Arguments.

Shell should return a value if you run it as a function, i.e.:
X=Shell "Notepad.exe"

It depends on the app you're running for a return value. If this doesn't work, you'll have to use some API's to create a process, and wait for the process to terminate, and retrieve the exit code.
 
Where can I find the various values returned by the shell command?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top