PowerBasic Museum 2020-A

Legacy Software (PBWIN 9.0+/PBCC 5.0+) => Source Code => Scripting => Windows Script Host => Topic started by: José Roca on July 14, 2008, 07:28:21 AM

Title: IWshShell.Run Method
Post by: José Roca on July 14, 2008, 07:28:21 AM


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