当前位置: 移动技术网 > IT编程>脚本编程>VBScript > VBS加密解密源码(UserAccounts.CommonDialog) 脚本之家修正版

VBS加密解密源码(UserAccounts.CommonDialog) 脚本之家修正版

2017年12月08日  | 移动技术网IT编程  | 我要评论

重生风流王,陈立穗,八哥电影战狼2在线播放

用法:

1.copy下面代码至文本文档
2.将文件后缀名改为.vbs
3.双击运行
复制代码 代码如下:

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

注意上面的代码只有在winxp下使用,原因可以参考因为那个选择文件功能不能使用而已,下面我们修改下,让他支持win2000,win2003系统,我们可以通过拖动文件到这个vbs上即可。
移动技术网修改的加强版本
复制代码 代码如下:

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

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网