小江江的成长之路 2011-02-26
代码如下:
Ans = InPutBox("请输入要执行的操作:1.加密,2.解密,3.退出。") Ans = Int(Ans) If Ans =1 Then set fso=createobject("scripting.filesystemobject") Set objDialog = CreateObject("UserAccounts.CommonDialog") objDialog.Filter = "vbs File|*.vbs|All Files|*.*" objDialog.InitialDir = "" objDialog.ShowOpen strLoadFile = objDialog.FileName if not strLoadFile = "" then set op=fso.opentextfile(strLoadFile) dow=13 do while op.atendofstream=false line=op.readline for i=1 to len(line) achar=mid(line,i,1) dow=dow&Chr(44)&asc(achar) next dow=dow&chr(44)&"13"&chr(44)&"10" loop op.close set op=fso.opentextfile(strLoadFile,2) op.write "strs=array("&dow&")"&chr(13)&chr(10)&_ "for i=1 to UBound(strs)"&chr(13)&chr(10)&_ " runner=runner&chr(strs(i))"&chr(13)&chr(10)&_ "next"&chr(13)&chr(10)&_ "Execute runner" msgbox "加密成功",,"提示" end if end if If Ans = 2 Then Set objfs=CreateObject("scripting.filesystemobject") Set objDialog=CreateObject("UserAccounts.CommonDialog") objDialog.Filter="vbs File|*.vbs|All Files|*.*" objDialog.InitialDir = "" objDialog.ShowOpen strLoadFile = objDialog.FileName if not strLoadFile = "" then set objf=objfs.opentextfile(strLoadFile) str=objf.ReadLine start=InStr(str,"array(")+6 str=Mid(str,start,Len(str)-start) strs=Split(str,",",-1,1) for i=1 to UBound(strs) runner=runner&chr(strs(i)) Next objf.Close Set objf=objfs.OpenTextFile(strLoadFile,2) objf.Write runner MsgBox "解密成功",,"提示" end if end if if Ans = 3 Then Wscript.Quit End If
代码如下:
If WScript.Arguments.Count=0 Then WScript.Quit strLoadFile=WScript.Arguments(0) Ans = InPutBox("请输入要执行的操作:1.加密,2.解密,3.退出。") Ans = Int(Ans) If Ans =1 Then set fso=createobject("scripting.filesystemobject") if not strLoadFile = "" then set op=fso.opentextfile(strLoadFile) dow=13 do while op.atendofstream=false line=op.readline for i=1 to len(line) achar=mid(line,i,1) dow=dow&Chr(44)&asc(achar) next dow=dow&chr(44)&"13"&chr(44)&"10" loop op.close set op=fso.opentextfile(strLoadFile,2) op.write "strs=array("&dow&")"&chr(13)&chr(10)&_ "for i=1 to UBound(strs)"&chr(13)&chr(10)&_ " runner=runner&chr(strs(i))"&chr(13)&chr(10)&_ "next"&chr(13)&chr(10)&_ "Execute runner" msgbox "加密成功",,"提示" end if end if If Ans = 2 Then Set objfs=CreateObject("scripting.filesystemobject") if not strLoadFile = "" then set objf=objfs.opentextfile(strLoadFile) str=objf.ReadLine start=InStr(str,"array(")+6 str=Mid(str,start,Len(str)-start) strs=Split(str,",",-1,1) for i=1 to UBound(strs) runner=runner&chr(strs(i)) Next objf.Close Set objf=objfs.OpenTextFile(strLoadFile,2) objf.Write runner MsgBox "解密成功",,"提示" end if end if if Ans = 3 Then Wscript.Quit End If