Tr4c3:为了方便在dos下使用,我把inputbox改成了args。
复制代码 代码如下:
'ProgramByxiaolu
'name:file2vbs.vbs
Onerrorresumenext
SetArgs=Wscript.Arguments
IfArgs.length<>2Then
Wscript.Echo"Usage:"&Wscript.ScriptName&"c:muma.exec:muma.vbs"
Wscript.Quit
EndIf
dowhile1
fname=Args(0)
SetAdo=CreateObject("adodb.stream")
WithAdo
.Type=1
.open
.loadfromfilefname
ss=.read
EndWith
exitdo
Loop
fname=Args(1)
SetFso=CreateObject("Scripting.FileSystemObject")
SetFile=fso.OpenTextFile(fname,2,True)
lens=lenB(ss)mod500
Forj=0toint(lenB(ss)/500)-1
ifj=0then
File.writeline"ss="""&Bin2Str(midb(ss,500*j+1,500))&"""_"
else
File.writeline"+"""&Bin2Str(midb(ss,500*j+1,500))&"""_"
endif
next
iflens>0then
File.writeline"+"""&Bin2Str(rightb(ss,lens))&""""
else
File.writeline"+"&chr(34)&chr(34)
endif
File.writeline""
File.writeline"SetRS=CreateObject(""ADODB.Recordset""):L=Len(ss)/2:RS.Fields.Append""m"",205,L:RS.Open:RS.AddNew:RS
(""m"")=ss&ChrB(0):RS.Update:ss=RS(""m"").GetChunk(L)"
File.writeline"Sets=CreateObject(""ADODB.Stream""):withs:.Mode=3:.Type=1:.Open():.Writess:.SaveToFile
wscript.arguments(0),2:endwith"
File.close
Setfso=nothing
Ado.close
setAbo=nothing
FunctionBin2Str(Re)
Fori=1TolenB(Re)
bt=AscB(MidB(Re,i,1))
ifbt<16ThenBin2Str=Bin2Str&"0"
Bin2Str=Bin2Str&Hex(bt)
Next
EndFunction
重新生成文件的办法
cscriptxx.vbsx:xxxx.exe