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 Any2Bat.vbs a vbs script that converts any file into a batch

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article is about how to convert any file into a batch vbs script Any2Bat.vbs. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Encoding data with Base64 has the advantage of compressing the size (as opposed to bin2str) and the disadvantage of increasing processing time and script complexity.

Since the bottleneck of efficiency is in the step of generating vbs from bat, it is generally cost-effective.

Writing documents with ADODB.Recordset is much better than debug.

Most things are done by scripts, and batch processing is just using echo to generate scripts.

The advantage of the echo version is that the file will be uploaded by copying and pasting it all into cmd shell.

The code is as follows:

'Any2Bat.vbs by zzzEVAzzz

On error resume next

Set arg=wscript.arguments

If arg.count=0 then wscript.quit

With CreateObject ("ADODB.Stream")

.type = 1:.open:.loadfromfile arg (0): bs=.read:l=.size:.close

End with

If err.number0 then wscript.quit

Set fso=CreateObject ("Scripting.FileSystemObject")

With fso.opentextfile (arg (0) & ".bat", 2Jing true)

If err.number0 then wscript.quit

.writeline "@ echo bs=_ > xx.vbs"

For Kraft 1 to l step 129

.write "@ echo"

.write b64b (midb (bs,k,129))

.writeline "" + _ > > xx.vbs "

Next

.writeline "@ echo": set rs=CreateObject ("" ADODB.Recordset "") > > xx.vbs "

.writeline "@ echo set ado=CreateObject ("ADODB.Stream") > > xx.vbs"

.writeline "@ echo l=len (bs): ss=": for Knowled1 to l step 4096:ss=ss+ub64 (mid (bs,k,4096)): next:l=len (ss) > > xx.vbs "

.writeline "@ echo rs.fields.append"b", 205 LGX 2VR rs.openVOR rs.addnewRose ("" b "") = ss+chrb (0): rs.update > > xx.vbs "

.writeline "@ echo ado.mode=3:ado.type=1:ado.open:ado.write rs ("b") .getchunk (lstroke 2) > > xx.vbs"

.writeline "@ echo ado.savetofile" + fso.getfilename (arg (0)) + "", 2:ado.close > > xx.vbs "

.writeline "@ echo function ub64 (s): dim t (4), b (3): ub64=": n=len (s): rwrite2 > > xx.vbs "

.writeline "@ echo if n mod 4 ^ 0 then exit function:end if:for iTunes 1 to n step 4:for jacks 0 to 3 > > xx.vbs"

.writeline "@ echo a=asc (mid): if axiom 43 then:a=62:else if axiom 47 then:a=63:else if a ^ > 47 and a ^ > xx.vbs"

.writeline "@ echo a=a+4:else if asides 61 then:a=0:if renders 2 then r=j-2:end if:else if a ^ > 64 and a ^ > xx.vbs"

.writeline "@ echo a=a-65:else if a ^ > 96 and a ^ > xx.vbs"

.writeline "@ echo end if:end if:end if:end if:end if:end if:t (j) = a:next > > xx.vbs"

.writeline "@ echo b (0) = t (0) + t (1) * 64 mod 256 xx.vbs b (1) = t (1)\ 4 mod 256 xx.vbs"

.writeline "@ echo for jacked 0 to r:if b (j) ^ > xx.vbs"

.writeline "@ echo next:next:end function > > xx.vbs&&cscript.exe / / nologo xx.vbs&del xx.vbs"

End with

Const b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"

Function b64b (bin)

B64b = ""

N=lenb (bin)

For iTunes 1 to n step 3

A=ascb (midb (bin,i,1))

B64b=b64b+mid (b64, a mod 64. 1)

If i

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