Microsoft 腳本中心的VBS加密代碼——Encode a Script


原文鏈接:https://gallery.technet.microsoft.com/scriptcenter/16439c02-3296-4ec8-9134-6eb6fb599880

使用方法:先將下面代碼存為VBS腳本,然后拖拽需要加密的VBS腳本到此腳本,即可完成加密。

Option Explicit

dim oEncoder, oFilesToEncode, file, sDest
dim sFileOut, oFile, oEncFile, oFSO, i
dim oStream, sSourceFile

set oFilesToEncode = WScript.Arguments
set oEncoder = CreateObject("Scripting.Encoder")

For i = 0 to oFilesToEncode.Count - 1
    set oFSO = CreateObject("Scripting.FileSystemObject")
    file = oFilesToEncode(i)
    set oFile = oFSO.GetFile(file)
    Set oStream = oFile.OpenAsTextStream(1)
    sSourceFile=oStream.ReadAll
    oStream.Close
    sDest = oEncoder.EncodeScriptFile(".vbs",sSourceFile,0,"")
    sFileOut = Left(file, Len(file) - 3) & "vbe"
    Set oEncFile = oFSO.CreateTextFile(sFileOut)
    oEncFile.Write sDest
    oEncFile.Close
Next

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM