• Welcome to Jose's Read Only Forum 2023.
 

IWshShell.Run Method

Started by José Roca, July 14, 2008, 07:28:21 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

José Roca



The following code opens a command window, changes to the path to C:\ , and executes the DIR command.

VBScript


Dim oShell
Set oShell = WScript.CreateObject ("WSCript.shell")
oShell.run "cmd /K CD C:\ & Dir"
Set oShell = Nothing


PowerBASIC


DIM pWsh AS IWshShell
pWsh = NEWCOM "WScript.Shell"
pWsh.Run(UCODE$("cmd /K CD C:\ & Dir"))
pWsh = NOTHING