var ExtractExeLocation = "%SystemRoot%\\SYSTEM32";
var ExtractExe = Combine(ExtractExeLocation, "extract.exe");
function Combine(dir, file)
{
return dir + "\\" + file ;
}
function QuoteStr(string)
{
return ("\"" + string + "\"");
}
function Exec(string, flagWait)
{
if (flagWait == null)
flagWait = true;
var WScriptShell = WScript.CreateObject("WScript.Shell");
return WScriptShell.Run(string, 0, flagWait);
}
function ExtractFilesFromXSN(xsnInputPath, outputDirectory)
{
var Parameters;
// add the location to place extracted files,
// a flag "/Y" that prevents prompting before overwriting
// an existing file, and a flag "/E" that orders to
// extract all files
if (outputDirectory != null)
Parameters = " /Y /E /L " + QuoteStr(outputDirectory);
Exec(QuoteStr(ExtractExe)
+ Parameters
+ " " + QuoteStr(xsnInputPath), true);
}