Saturday, June 11, 2011

Using DOS Commands in your vb script for QTP

'msgbox(WinDir)

On Error Resume Next
dim ws
Set ws = wscript.CreateObject("Scripting.FileSystemObject")
' Windows shell object
Dim WshShell : Set WshShell = nothing
Set WshShell = Wscript.CreateObject("WScript.Shell") : CheckError
Public function SystemCmd(cmd)

Dim objShell
Set objShell = CreateObject("WScript.Shell")
objShell.Run cmd
WScript.Quit

End Function
SystemCmd "xcopy.exe C:\DOCUME~1\SIQBAL~1.APP\Application Data\.purple\logs\jabber d:\movies "
C:\Documents and Settings\siqbal.APPLICATIONS\Application Data\.purple\logs\jabber
'Dim WinDir : WinDir = WshShell.ExpandEnvironmentStrings("%WinDir%") : CheckError
'WinDir = WinDir & "\DownLoaded Program Files\"
'WinDir = Replace(WinDir, "\", "/")
'msgbox WinDir
'copy

No comments:

Post a Comment