@set @junk=1 /*
@echo off
cscript //nologo //E:jscript %0 %*
goto :eof
/
if(WScript.Arguments.Length < 1){
WScript.Echo("usage: spl2df.bat [Input file] [(Optional) Output file]");
WScript.Quit(-1);
}
var inputPath = WScript.Arguments.Item(0);
var outputPath = inputPath + "_DF";
if(WScript.Arguments.Length >= 2){
outputPath = WScript.Arguments.Item(1);
}
var scVB = WScript.CreateObject("ScriptControl");
scVB.Language = "VBScript";
scVB.AddCode("Function vbBinary_getSize(text) : vbBinary_getSize = LenB(text) : End Function");
scVB.AddCode("Function vbBinary_At(text, index) : vbBinary_At = AscB(MidB(text, index + 1, 1)) : End Function");
function Binary(data)
{
this.data = data;
this.size = scVB.Run("vbBinary_getSize", this.data);
}
function Binary_At(index)
{
if (index < 0 || index >= this.size)
return 0;
return scVB.Run("vbBinary_At", this.data, index);
}
function Binary_charAt(index)
{
if (index < 0 || index >= this.size)
return "";
return String.fromCharCode(scVB.Run("vbBinary_At", this.data, index));
}
Binary.prototype.At = Binary_At;
Binary.prototype.charAt = Binary_charAt;
var stIn = WScript.CreateObject("ADODB.Stream");
stIn.type = 1; // adTypeBinary
stIn.Open();
stIn.loadFromFile(inputPath);
var bindata = stIn.read();
var data = new Binary(bindata);
for(var i = 0; i < data.size; i++){
WScript.Echo(data.At(i).toString(16));
}
stIn.Close();
最終更新:2013年08月19日 10:31