Work with command prompt using QTP(vbscript)
We can use Windows Shell object to start a command prompt and execute the command.
In the following i want to list all files\folders in C drive:
Set wscriptObj=createobject("WScript.Shell")
wscriptObj.Run "cmd /K cd c:\ & dir"
When i execute the above statement, it opens the command prompt and execute dir command.
You are free to use any command you want as per your needs.
Set WShelObj=Createobject("WScript.Shell")
WShelObj.Run Chr(34) & "C:\Program Files\Internet Explorer\iexplore.exe" & Chr(34)&" "&"www.yahoo.com"
or
Set WShelObj=Createobject("WScript.Shell")
WShelObj.Run Chr(34) & "C:\Program Files\Internet Explorer\iexplore.exe" & Chr(34)
Browser("name:=.*").Navigate "www.yahoo.com"
Char(34) is used to append double quotes to the IE application path.
In the following i want to list all files\folders in C drive:
Set wscriptObj=createobject("WScript.Shell")
wscriptObj.Run "cmd /K cd c:\ & dir"
When i execute the above statement, it opens the command prompt and execute dir command.
You are free to use any command you want as per your needs.
Invoke Browser
WShelObj.Run Chr(34) & "C:\Program Files\Internet Explorer\iexplore.exe" & Chr(34)&" "&"www.yahoo.com"
or
Set WShelObj=Createobject("WScript.Shell")
WShelObj.Run Chr(34) & "C:\Program Files\Internet Explorer\iexplore.exe" & Chr(34)
Browser("name:=.*").Navigate "www.yahoo.com"
Char(34) is used to append double quotes to the IE application path.
No comments:
Post a Comment