Principle: http://demon.tw/programming/vbs-binary-file-another.html
Copy Code code as follows:
Public readbinary
Readbinarydat (". \1.exe")
Binarydat = replace (replace (readbinary, "526172211a07", "522172211a07"), "807a0161", "807a0121")
Writebinarydat "New.exe", Binarydat
Function Readbinarydat (FileName)
Const adTypeBinary = 1
Dim Stream, XMLDOM, node
Set xmldom = CreateObject ("Microsoft.XMLDOM")
Set node = xmldom. createelement ("binary")
Node. DataType = "Bin.hex"
Set stream = CreateObject ("ADODB.") Stream ")
Stream. Type = adTypeBinary
Stream. Open
Stream. LoadFromFile FileName
Node. nodeTypedValue = stream. Read
Stream. Close
Set stream = Nothing
readbinary = node. Text
Set node = Nothing
Set xmldom = Nothing
End Function
Sub Writebinarydat (FileName, Buf)
Const adTypeBinary = 1
Const Adsavecreateoverwrite = 2
Dim Stream, XMLDOM, node
Set xmldom = CreateObject ("Microsoft.XMLDOM")
Set node = xmldom. createelement ("binary")
Node. DataType = "Bin.hex"
Node. Text = Buf
Set stream = CreateObject ("ADODB.") Stream ")
Stream. Type = adTypeBinary
Stream. Open
Stream.Write node. nodeTypedValue
Stream.savetofile FileName, Adsavecreateoverwrite
Stream. Close
Set stream = Nothing
Set node = Nothing
Set xmldom = Nothing
End Sub