Forum Discussion
irina_lukina
14 years agoSuper Contributor
Hi Ofer,
I've corrected your code a little bit, and it works fine:
var TargetFolder = "C:\\Logs";
var objShell = new ActiveXObject("Shell.Application");
var objFolder = objShell["Namespace"](TargetFolder);
var colItems = objFolder["Items"]();
for (var i = 0; i < colItems["Count"]; i++)
colItems["Item"](i)["InvokeVerbEx"]("Print");
FYI, the CreateObject object in VBScript corresponds to the new ActiveXObject statement in C#Script. Also, there is no need to specify Next at the end of the For statement. I hope this information helps :)