PDA

View Full Version : Solved: run DOS command without waiting ?



hardlife
09-27-2009, 05:22 AM
Does somebody knows if it is possible to send DOS command
and continue in code without waiting for DOS to finish?


Sub sleepANDwork()
Set objShell = CreateObject("WScript.Shell")
strCommand = "cmd /c ping 1.0.0.0 -n 1 -w 5000 >NUL" 'that will stop for 5 seconds.
objShell.Run strCommand, 0, True
MsgBox "happy and sunny day"
End Sub


me is wishing happy and sunny day to Everybody.

Oorang
09-27-2009, 12:49 PM
The Shell command should do that for you:
Sub sleepANDwork()
Dim strCommand As String
strCommand = "cmd /k dir /s /a"
Shell strCommand
MsgBox "happy and sunny day"
End Sub


You might also have a look at this: http://www.vbaexpress.com/kb/getarticle.php?kb_id=971

hardlife
09-27-2009, 02:28 PM
Dear Aaron, thank You a lot for Your answer, it is usefull
because me was not able to progress.

probably other posibility, googled:


Shell "WScript " & """MyPath\MyScript.vbs"""
MsgBox "Happy and sunny day, good night for now."


With best regards,
Pavel