把任意文件轉(zhuǎn)成vbs文件的file2vbs的vbs代碼
來(lái)源:本站原創(chuàng)|時(shí)間:2020-01-10|欄目:vb|點(diǎn)擊: 次
Tr4c3:為了方便在dos下使用,我把inputbox改成了args。
復(fù)制代碼 代碼如下:
'Program By xiaolu
'name:file2vbs.vbs
On error resume next
Set Args = Wscript.Arguments
If Args.length<>2 Then
Wscript.Echo "Usage:" & Wscript.ScriptName & " c:\muma.exe c:\muma.vbs"
Wscript.Quit
End If
do while 1
fname = Args(0)
Set Ado = CreateObject("adodb.stream")
With Ado
.Type = 1
.open
.loadfromfile fname
ss = .read
End With
exit do
Loop
fname = Args(1)
Set Fso=CreateObject("Scripting.FileSystemObject")
Set File=fso.OpenTextFile(fname,2, True)
lens=lenB(ss) mod 500
For j=0 to int(lenB(ss)/500)-1
if j=0 then
File.writeline "ss="""&Bin2Str(midb(ss,500*j+1,500))&"""_"
else
File.writeline "+"""&Bin2Str(midb(ss,500*j+1,500))&"""_"
end if
next
if lens>0 then
File.writeline "+"""&Bin2Str(rightb(ss,lens))&""""
else
File.writeline "+"&chr(34)&chr(34)
end if
File.writeline ""
File.writeline "Set RS=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 "Set s=CreateObject(""ADODB.Stream""):with s:.Mode = 3:.Type = 1:.Open():.Write ss:.SaveToFile
wscript.arguments(0),2:end with"
File.close
Set fso=nothing
Ado.close
set Abo=nothing
Function Bin2Str(Re)
For i = 1 To lenB(Re)
bt = AscB(MidB(Re, i, 1))
if bt < 16 Then Bin2Str=Bin2Str&"0"
Bin2Str=Bin2Str & Hex(bt)
Next
End Function
重新生成文件的辦法
cscript xx.vbs x:\xxxx.exe
您可能感興趣的文章
- 01-10下載文件到本地運(yùn)行的vbs
- 01-10VBS教程:屬性-Type 屬性
- 01-10VBS教程:屬性-Size 屬性
- 01-10利用vbscript腳本修改文件內(nèi)容,此適用于自動(dòng)化的操作中
- 01-10腳本編程3 關(guān)于文件的讀寫(xiě)
- 01-10利用wscript執(zhí)行文件[包括可執(zhí)行exe文件]vbs腳本
- 01-10ntiIframe.vbs用于批量清除被添加到文件中的惡意代碼
- 01-10一個(gè)可以刪除指定天數(shù)文件的vbs腳本
- 01-10用vbs實(shí)現(xiàn)定時(shí)運(yùn)行web文件的方法
- 01-10vbscript腳本編程教程2利用fso來(lái)進(jìn)行文件操作


閱讀排行
- 1C語(yǔ)言 while語(yǔ)句的用法詳解
- 2java 實(shí)現(xiàn)簡(jiǎn)單圣誕樹(shù)的示例代碼(圣誕
- 3利用C語(yǔ)言實(shí)現(xiàn)“百馬百擔(dān)”問(wèn)題方法
- 4C語(yǔ)言中計(jì)算正弦的相關(guān)函數(shù)總結(jié)
- 5c語(yǔ)言計(jì)算三角形面積代碼
- 6什么是 WSH(腳本宿主)的詳細(xì)解釋
- 7C++ 中隨機(jī)函數(shù)random函數(shù)的使用方法
- 8正則表達(dá)式匹配各種特殊字符
- 9C語(yǔ)言十進(jìn)制轉(zhuǎn)二進(jìn)制代碼實(shí)例
- 10C語(yǔ)言查找數(shù)組里數(shù)字重復(fù)次數(shù)的方法
本欄相關(guān)
- 01-10下載文件到本地運(yùn)行的vbs
- 01-10飄葉千夫指源代碼,又稱(chēng)qq刷屏器
- 01-10SendKeys參考文檔
- 01-10什么是一個(gè)高效的軟件
- 01-10VBS中的正則表達(dá)式的用法大全 &l
- 01-10exe2swf 工具(Adodb.Stream版)
- 01-10VBS中SendKeys的基本應(yīng)用
- 01-10用VBSCRIPT控制ONSUBMIT事件
- 01-10VBScript教程 第十一課深入VBScript
- 01-10VBScript語(yǔ)法速查及實(shí)例說(shuō)明
隨機(jī)閱讀
- 01-10使用C語(yǔ)言求解撲克牌的順子及n個(gè)骰子
- 01-10C#中split用法實(shí)例總結(jié)
- 01-11Mac OSX 打開(kāi)原生自帶讀寫(xiě)NTFS功能(圖文
- 08-05dedecms(織夢(mèng))副欄目數(shù)量限制代碼修改
- 08-05DEDE織夢(mèng)data目錄下的sessions文件夾有什
- 01-10delphi制作wav文件的方法
- 04-02jquery與jsp,用jquery
- 01-11ajax實(shí)現(xiàn)頁(yè)面的局部加載
- 08-05織夢(mèng)dedecms什么時(shí)候用欄目交叉功能?
- 01-10SublimeText編譯C開(kāi)發(fā)環(huán)境設(shè)置