// Poly-fill the String trim method.
if(!String.prototype.trim) {
    String.prototype.trim = function() {
        return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
    };
}

// Create the file system object.
var ForReading = 1, ForWriting = 2, ForAppending = 8;
var fso = WScript.CreateObject("Scripting.FileSystemObject");

// Get the file name.
var fileName = WScript.Arguments(0);

// Create the output file.
var outputFilePath = WScript.Arguments(1);
var outputFile = fso.CreateTextFile(outputFilePath);
outputFile.WriteLine("# Auto-generated; do not edit");
outputFile.WriteLine("bin\\" + fileName + ": ..\\AppPackages\\" + fileName);
outputFile.WriteLine("\tExtractPackage.cmd %%CD%%");
outputFile.WriteLine("\tCOPY /Y $? $@");
outputFile.Close();
