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

Synchonous Using Shell command

Status
Not open for further replies.

JR4VB

Technical User
Jan 13, 2003
36
US
I am using the shell command to run a dos command and return the information to a text file. The next lines of my code are looking for this data in the text file to be valid. Is there as easy way to make this shell process synchonous with the rest of the Visual Basic Program? So far investigating this I have only found one way of doing this which looks a bit over my head using the kernal32.dll to keep checkin to see if that proccess thread is still active. If anyone knows a way to do this please let me know. Thanks.

JR
 
if you do not like using the API then you could use the following:

Code:
Dim oShell As Object
Dim nRet As Long

Set oShell = CreateObject("WSCript.shell")
nRet = oShell.Run("notepad", , True)
Set oShell = Nothing
Print "return value: " & nRet

got the idea from somebody here at tek-tips a while back
search is still down so I can't direct you to the original thread(s)
 
Or see faq222-428 - it's not that bad. Sunaj
'The gap between theory and practice is not as wide in theory as it is in practice'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top