VBS 二进制填充文件

生成一个指定字节数的AutomaticallyGenerated.bin文件

Const adModeWrite=2
Const adTypeBinary=1
Dim stream,xmldom,node
Set xmldom=CreateObject("Microsoft.XMLDOM")
Set node=xmldom.CreateElement("binary")
With node
  .DataType="bin.hex"
  .Text="FF"
End With
Set stream=CreateObject("Adodb.Stream")
With stream
  .Type=adTypeBinary
  .Open
  For i=1 to Int(eval(InputBox("Size(byte):")))
    .Write node.NodeTypedValue
  Next
  .SaveToFile "AutomaticallyGenerated.bin",adModeWrite
  .Flush
  .Close
End With
Set xmldom=Nothing
Set node=Nothing
Set stream=Nothing
Wscript.Echo "Done"