VBS加密解密源碼(UserAccounts.CommonDialog) 腳本之家修正版
1.copy下面代碼至文本文檔
2.將文件后綴名改為.vbs
3.雙擊運(yùn)行
Ans = InPutBox("請(qǐng)輸入要執(zhí)行的操作: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
注意上面的代碼只有在winxp下使用,原因可以參考http://www.dbjr.com.cn/article/26390.htm因?yàn)槟莻€(gè)選擇文件功能不能使用而已,下面我們修改下,讓他支持win2000,win2003系統(tǒng),我們可以通過(guò)拖動(dòng)文件到這個(gè)vbs上即可。
腳本之家修改的加強(qiáng)版本
If WScript.Arguments.Count=0 Then WScript.Quit
strLoadFile=WScript.Arguments(0)
Ans = InPutBox("請(qǐng)輸入要執(zhí)行的操作: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
相關(guān)文章
用VBS調(diào)用程序并對(duì)程序的運(yùn)行情況進(jìn)行監(jiān)控的兩個(gè)代碼
用VBS調(diào)用程序并對(duì)程序的運(yùn)行情況進(jìn)行監(jiān)控的兩個(gè)代碼...2007-03-03自動(dòng)寫(xiě)入文件上傳到指定服務(wù)器SoftwareMeteringCLS.vbs源碼
本次文章其中所用腳本代碼為ghiconan版主提供的由Branimir petrovic編寫(xiě)的代碼,我在后面根據(jù)我公司現(xiàn)有的網(wǎng)絡(luò)情況做了一些文件管理的添加與刪除,最后有用FTP批處理的方法上傳到服務(wù)器內(nèi)!2008-12-12初窺WMI_Vbs腳本編程簡(jiǎn)明教程補(bǔ)充讀物
看了沼澤介紹的wmi腳本相關(guān)知識(shí),對(duì)新手是個(gè)不錯(cuò)的教材,如果想和系統(tǒng)結(jié)合的更好,想實(shí)現(xiàn)更大功能的代碼,那么學(xué)習(xí)vbs就不得不用wmi腳本2008-06-06vbs 錯(cuò)誤捕獲器,用于捕獲內(nèi)部錯(cuò)誤并進(jìn)行手工處理
vbs中的錯(cuò)誤捕獲器,用于捕獲內(nèi)部錯(cuò)誤并進(jìn)行手工處理2009-08-08雷客圖 站長(zhǎng)安全助手 vbs版代碼(asp 木馬查找)
雷客圖ASP站長(zhǎng)安全助手vbs版 使用說(shuō)明2009-07-07監(jiān)測(cè)windows主機(jī)網(wǎng)絡(luò)接口利用率的vbs代碼
這篇文章主要介紹了監(jiān)測(cè)windows主機(jī)網(wǎng)絡(luò)接口利用率的vbs代碼,不用任何軟件沒(méi)有安全隱患,學(xué)習(xí)vbs的朋友可以參考一下2019-10-10用vbscript實(shí)現(xiàn)在文本文件中搜索兩個(gè)項(xiàng)
用vbscript實(shí)現(xiàn)在文本文件中搜索兩個(gè)項(xiàng)...2007-04-04