Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use vbs to convert a file into a vbs statement

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces how to use vbs to convert files into vbs statements, the article is very detailed, has a certain reference value, interested friends must read it!

This is not all types of exe2vbs files can be converted, but limited to the size of string files can not be too large, I have tested 3m files is OK.

Save the following code as: file2vbs.vbs

The copy code is as follows:

'Program By xiaolu

'name:file2vbs.vbs

On error resume next

Do while 1

Fname=InputBox ("Please enter the file name (including path) to be converted:", "enter the file name", "f:\ hhh.exe")

If fname= "" then Wscript.quit

Err.number=0

Set Ado = createObject ("adodb.stream")

With Ado

.Type = 1

.open

.loadfromfile fname

Ss = .read

End With

If err.number0 then

If msgbox ("File opening error!", 1, "File2VBS") = 2 then Wscript.quit

Else

Exit do

End if

Loop

Fname=InputBox ("Please enter the vbs name (including the path):", "enter the file name", "f:\ hhh.vbs")

If fname= "" then Wscript.quit

Set Fso=createObject ("Scripting.FileSystemObject")

Set File=fso.OpenTextFile (fname,2, True)

Lens=lenB (ss) mod 500

For juni0 to int (lenB (ss) / 500)-1

If jung0 then

File.writeline "ss="& Bin2Str (midb (ss,500*j+1500)) &"_"

Else

File.writeline "+" & Bin2Str (midb (ss,500*j+1500)) & "" _ "

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 ", 205GetChunk (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

The method of generating files

Cscript file2vbs.vbs c:\ test.exe

The above is all the contents of the article "how to use vbs to convert files into vbs statements". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report