// set default seekPath
var seekPath = "D:\\ICF_AutoCapsule_disabled\\Programs";
var outFName = "paths.log";

// check arg
var arg = WScript.Arguments.Unnamed;
if(arg.Count >= 1){
	outFName = arg.Item(0);
}

// seek Program paths
var fso = new ActiveXObject("Scripting.FileSystemObject");
var paths = {};
var dirs = fso.GetFolder(seekPath).SubFolders;
var em = new Enumerator(dirs);

// write output file
var wStream = fso.OpenTextFile(outFName, 2, true, -2);
for(em.moveFirst(); !em.atEnd(); em.moveNext()){
	var item = em.item().Name;
	var path = seekPath + "\\" + item + "\\" + item + ".exe";
	if(fso.FileExists(path)){
	    wStream.WriteLine(path);
	}
}
wStream.Close();