This sample lists all VBScript files on the C: drive. Look at VBScript
or JScript code.
VBScript Sample
Option Explicit
' Attribute constants
const sgfAll = &H00001FF7&
const sgfArchive = &H00000020&
const sgfCompressed = &H00000800&
const sgfDirectory = &H00000010&
const sgfEncrypted = &H00000040&
const sgfHidden = &H00000002&
const sgfNormal = &H00000080&
const sgfOffline = &H00001000&
const sgfReadOnly = &H00000001&
const sgfReparsePoint = &H00000400&
const sgfSparseFile = &H00000200&
const sgfSystem = &H00000004&
const sgfTemporary = &H00000100&
Dim en, item
Set en = CreateObject("SGFileSys.Enumerator")
en.RootPath = "C:\"
en.Recurse = True
en.NameMask = "*.vbs"
en.AttributeMask = sgfAll - sgfDirectory
For Each item In en.Items
WScript.Echo item.Path
Next
JScript Sample
var sgfAll = 0x00001FF7;
var sgfArchive = 0x00000020;
var sgfCompressed = 0x00000800;
var sgfDirectory = 0x00000010;
var sgfEncrypted = 0x00000040;
var sgfHidden = 0x00000002;
var sgfNormal = 0x00000080;
var sgfOffline = 0x00001000;
var sgfReadOnly = 0x00000001;
var sgfReparsePoint = 0x00000400;
var sgfSparseFile = 0x00000200;
var sgfSystem = 0x00000004;
var sgfTemporary = 0x00000100;
var en = new ActiveXObject("SGFileSys.Enumerator")
en.RootPath = "C:\\"
en.Recurse = true;
en.NameMask = "*.vbs";
en.AttributeMask &= ~sgfDirectory;
// Create JScript enumerator
// Do this after enumeration properties have been set
var items = new Enumerator(en.Items);
for (; !items.atEnd(); items.moveNext())
{
var item = items.item();
WScript.Echo(item.Path);
}