China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-12 23:13
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Encrypt VBS with VBS View 6,389 Replies 17
Original Poster Posted 2007-07-11 14:22 ·  中国 新疆 乌鲁木齐 电信
高级用户
★★★
Autowalk
Credits 845
Posts 375
Joined 2007-03-03 01:58
19-year member
UID 80606
Gender Male
Status Offline
```
set fso=createobject("scripting.filesystemobject")

scf=inputbox("Please enter the script file name to encrypt","VBS Encryption Program","*.vbs")
set op=fso.opentextfile(scf)
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(scf,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 "Encryption successful",,"¥Ye Qi Production¥"
```
你好,脚本专家!
<a target=blank href=tencent://message/?uin=29654761&Site=www.111.com&Menu=yes><img border="0" SRC=http://wpa.qq.com/pa?p=1:29654761:5 alt="点击这里给我发消息"></a>
Floor 2 Posted 2007-07-11 14:27 ·  中国 天津 电信
银牌会员
★★★
Credits 1,928
Posts 931
Joined 2007-01-06 11:46
19-year member
UID 75624
Gender Male
Status Offline
Produced by Ye Qi?

Isn't it originally created by Brother zhoushijay?
Floor 3 Posted 2007-07-11 15:11 ·  中国 新疆 乌鲁木齐 电信
高级用户
★★★
Autowalk
Credits 845
Posts 375
Joined 2007-03-03 01:58
19-year member
UID 80606
Gender Male
Status Offline
Ye Qi is my QQ name
你好,脚本专家!
<a target=blank href=tencent://message/?uin=29654761&Site=www.111.com&Menu=yes><img border="0" SRC=http://wpa.qq.com/pa?p=1:29654761:5 alt="点击这里给我发消息"></a>
Floor 4 Posted 2007-07-11 15:22 ·  中国 天津 电信
银牌会员
★★★
Credits 1,928
Posts 931
Joined 2007-01-06 11:46
19-year member
UID 75624
Gender Male
Status Offline
Sorry, I shouldn't have doubted Brother zhoushijay. :-)
Floor 5 Posted 2007-07-11 18:01 ·  中国 广东 深圳 电信
高级用户
★★★
Credits 793
Posts 312
Joined 2004-09-02 00:00
21-year member
UID 31104
Gender Male
Status Offline
Not bad, learn something.
Floor 6 Posted 2007-07-12 01:20 ·  中国 广西 玉林 博白县 电信
金牌会员
★★★★
Credits 3,687
Posts 1,467
Joined 2005-08-08 12:00
21-year member
UID 44210
Status Offline
It's cumbersome to input the script file name. Here's a modified one for selecting and inputting the script file:

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 "加密成功",,"¥夜七制作 - zh159修改¥"
end if
Floor 7 Posted 2007-07-12 18:47 ·  中国 广东 梅州 中移铁通
新手上路
Credits 3
Posts 2
Joined 2007-07-12 16:58
19-year member
UID 93804
Gender Male
Status Offline
Amazing, all are experts.
Floor 8 Posted 2007-07-12 20:49 ·  中国 浙江 杭州 电信
新手上路
Credits 10
Posts 4
Joined 2007-07-10 19:05
19-year member
UID 93652
Gender Male
Status Offline
Why are there no comments at all?......The program should have necessary comments....
Floor 9 Posted 2007-07-12 22:37 ·  中国 广西 玉林 博白县 电信
金牌会员
★★★★
Credits 3,687
Posts 1,467
Joined 2005-08-08 12:00
21-year member
UID 44210
Status Offline
Why must there be comments? Moreover, it's not that every line can be clearly commented.
Floor 10 Posted 2007-10-07 22:35 ·  中国 山东 青岛 联通
初级用户
★★
Credits 146
Posts 86
Joined 2007-10-01 11:27
18-year member
UID 98691
Gender Male
Status Offline
Floor 11 Posted 2007-10-07 22:43 ·  中国 上海 静安区 电信
中级用户
★★
Credits 400
Posts 211
Joined 2007-09-30 18:02
18-year member
UID 98650
Gender Male
Status Offline
That's good. It's different from the command-line encryption provided by Microsoft. Can you post the decryption one?
Floor 12 Posted 2007-11-10 10:50 ·  中国 安徽 芜湖 电信
高级用户
★★
Credits 537
Posts 219
Joined 2006-10-31 21:08
19-year member
UID 69036
Gender Male
From 芜湖
Status Offline
Oh, got it. msgbox runner

[ Last edited by huzixuan on 2007-11-10 at 11:31 AM ]
江湖远
碧空长
路茫茫

一个人漫无目的的奔跑,风,刺骨的冷....
Floor 13 Posted 2007-11-10 12:54 ·  中国 北京 教育网
初级用户
Credits 71
Posts 34
Joined 2007-09-07 18:08
18-year member
UID 96808
Gender Male
Status Offline
UserAccounts.CommonDialog
Not bad, learned another trick ;)
Floor 14 Posted 2007-11-16 19:19 ·  中国 广东 东莞 电信
新手上路
Credits 4
Posts 2
Joined 2005-09-20 12:54
20-year member
UID 42670
Status Offline
Oh, what a bummer! I encrypted a file without backing it up just now.
Floor 15 Posted 2007-11-18 22:45 ·  中国 新疆 石河子 电信
初级用户
Credits 50
Posts 25
Joined 2007-03-29 14:07
19-year member
UID 83301
Gender Male
Status Offline
UserAccounts.CommonDialog
This can only be used in XP, not very universal.
Forum Jump: