Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Question regarding comspec
#2
Solved: 10 Years, 9 Months, 2 Weeks ago
The Run function of a WScript.Shell object will give you the behavior you want.

References:

http://msdn.microsoft.com/en-us/library/...85%29.aspx

http://www.computerhope.com/cmd.htm

Code:
Dim wsh: Set wsh = CreateObject("WScript.Shell")

'Substitute the command to launch your command line utility here -->
Dim strCommand: strCommand = "ping google.com"

wsh.Run "cmd /c " & strCommand, 10, True

/c = terminate when the program returns
10 = show window based on QTP's window state
True = wait for the program to return before proceeding

You can also do multiple commands joining them with "&" in the command string in case you have to change directories before running your utility. (See the example in the MSDN link above)
Reply


Messages In This Thread
Question regarding comspec - by tester_rahul - 12-30-2010, 02:56 PM
RE: Question regarding comspec - by cdesserich - 12-31-2010, 03:09 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)