无聊时学着写过一个:- On Error Resume Next
- srcFile = "F:\壁纸\WallPaper.jpg"
- dstFile = "f:\dst.vbs"
-
- with CreateObject("ADODB.Stream")
- .Type = 1
- .Mode = 3
- .Open
- .LoadFromFile srcFile
- Bin = .Read
- End With
-
- Set fso = CreateObject("Scripting.FileSystemObject")
- Set f = fso.OpenTextFile(dstFile, 2, True)
- ext = fso.GetExtensionName(srcFile)
-
- f.WriteLine "ss=_"
-
- For i = 1 to lenB(Bin) Step 500
- f.WriteLine """" & Bin2Str(midB(Bin, i, 500)) & """&_"
- Next
-
- f.WriteLine """"":L=Len(ss)/2" & vbCrLf
- f.WriteLine "Set rs=CreateObject(""ADODB.Recordset""):rs.Fields.Append ""m"",205,L:rs.Open:rs.AddNew:rs(""m"")=ss&ChrB(0):rs.Update"
- f.WriteLine "with CreateObject(""ADODB.Stream""):.Mode=3:.Type=1:.Open:.Write rs(""m"").GetChunk(L):.SaveToFile ""_New."&ext&""",2:End with"
-
- Function Bin2Str(b)
- For j = 1 to lenB(b)
- s = AscB(MidB(b, j, 1))
- Bin2Str = Bin2Str & Right("0" & Hex(s), 2)
- Next
- End Function
复制代码
|