文章摘要:如何加密vbs数据 vbs 加密
通过在vbs中使用Execute对数据进行加密,代码如下: On Error Resume Next Set […]
通过在vbs中使用Execute对数据进行加密,代码如下:
On Error Resume Next
Set argv = WScript.Arguments
If argv.Count = 0 Then WScript.Quit
Set fso = CreateObject("scripting.filesystemobject")
With fso.OpenTextFile(argv(0),1)
data = .ReadAll : .Close
End With
With fso.OpenTextFile(argv(0)&".txt",2,True)
.WriteLine "data="&Chr(34)&ASCdata(data)&Chr(34)
.WriteLine "Function ChrData(Data)"
.WriteLine "MyArray = Split(Data, "","", -1, 1)"
.WriteLine "For each OldData in MyArray"
.WriteLine "Newdata=NewData"&Chr(38)&"chr(OldData)"
.WriteLine "Next"
.WriteLine "ChrData=NewData"
.WriteLine "End Function"
.WriteLine "execute Chrdata(data)"
.Close
End With
MsgBox "OK!",,"Encrypt"
Function ASCdata(Data)
num=len(data)
newdata=""
For j=1 to num
If j=num then
newdata=newdata&asc(mid(data,j,1))
Else
newdata=newdata&asc(mid(data,j,1))&","
End If
Next
ASCdata=newdata
End function
使用方法:将需要加密的VBS脚本拖动到这个加密程序文件中即可实现加密。