有趣的vbs小脚本

如果将vbs文件放到C:\Users\username\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\文件夹下可以实现开机自启效果

让电脑说话

1
createobject("sapi.spvoice").speak "你让我说我就说"

结束电脑进程

1
2
3
4
5
6
7
8
strComputer= "."
SetobjWMIService = GetObject _
("winmgmts://" & strComputer& "/root/cimv2")
SetcolProcessList = objWMIService.ExecQuery _
("Select * from Win32_Process WhereName = '进程名.exe'")
ForEach objProcess in colProcessList
objProcess.Terminate()
Next

打开网址

1
2
Set objShell = CreateObject("Wscript.Shell")
objShell.Run("http://www.karlrixon.github.io")

发送邮件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
NameSpace= "http://schemas.microsoft.com/cdo/configuration/"
Set Email = CreateObject("CDO.Message")
Email.From= "发件@qq.com"
Email.To= "收件@qq.com"
Email.Subject= "Test sendmail.vbs"
Email.Textbody= "OK!"
Email.AddAttachment"C:/1.txt"
WithEmail.Configuration.Fields
.Item(NameSpace&"sendusing")= 2
.Item(NameSpace&"smtpserver")= "smtp.邮件服务器.com"
.Item(NameSpace&"smtpserverport")= 25
.Item(NameSpace&"smtpauthenticate")= 1
.Item(NameSpace&"sendusername")= "发件人用户名"
.Item(NameSpace&"sendpassword")= "发件人密码"
.Update
EndWith
Email.Send

阻止打开某进程

1
2
3
4
5
6
7
8
do
set bag = getobject("winmgmts:\\.\root\cimv2")
set i = bag.execquery("selecct * from win32_process where name = 'QQ.exe'")
for each objprocess in i
objprocess.terminate
next
wscript.sleep 1000
loop

添加桌面快捷方式

1
2
3
4
5
6
7
8
set gangzi = WScript.CreateObject("WScript.Shell")
strDesktop= gangzi.SpecialFolders("Desktop")
set oShellLink = gangzi.CreateShortcut(strDesktop & "/InternetExplorer.lnk")

oShellLink.TargetPath= "http://www.fendou.info"
oShellLink.Description= "Internet Explorer"
oShellLink.IconLocation= "%ProgramFiles%/Internet Explorer/iexplore.exe, 0"
oShellLink.Save

直接关机

1
2
3
dim WSHshell 
set WSHshell = wscript.createobject("wscript.shell")
WSHshell.run "shutdown -f -s -t 00",0 ,true

无限语音报数

1
2
3
4
5
6
Set s = CreateObject("sapi.spvoice") 
i=0
do
s.speak i
i=i+1
loop

无限弹光驱

1
2
3
4
5
set wmp=createobject("wmplayer.ocx") 
set cd=wmp.cdromcollection.item(0)
do
cd.eject
loop

整人

1
2
3
4
5
6
7
8
9
10
11
12
13
14
on error resume next 
dim WSHshellA
set WSHshellA = wscript.createobject("wscript.shell")
WSHshellA.run "cmd.exe /c shutdown -r -t 180 -c ""说我是猪,不说我是猪就一分钟关机,不信,试下・・・"" ",0 ,true
dim a
do while(a <> "我是猪")
a = inputbox ("说我是猪,就不关机,快撒,说 ""我是猪"" ","说不说","",8000,7000)
msgbox chr(13) + chr(13) + chr(13) + a,0,"MsgBox"
loop
msgbox chr(13) + chr(13) + chr(13) + "早说就行了嘛"
dim WSHshell
set WSHshell = wscript.createobject("wscript.shell")
WSHshell.run "cmd.exe /c shutdown -a",0 ,true
msgbox chr(13) + chr(13) + chr(13) + "哈哈哈哈,好乖"

一键停止wscript.exe可以停止所有vbs进程

1
2
3
set ws=createobject("wscript.shell")
'ws.run "shutdown /a"
ws.run "taskkill /f /im wscript.exe"

简易数据加密

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
' 把数据转换成密文,只支持标准ANSI(0-999)
' Version: 1.0
' Date: 2018-3-28
' Author: Heom, Icy_Ybk

Option Explicit

Dim Put, PassWord, Emmm

Put = InputBox("输入")
PassWord = InputBox("密文", "", ToHex(Put))
Emmm = InputBox("解密", "", HexTo(PassWord))

Function ToHex(Data) ' 加密
Dim ASCII, Num, i ' 声明
ASCII = "": ToHex = "": Num = 0 ' 初始化

For i = 1 To Len(Data) ' 将数据转ANSI码
ASCII = ASCII & Right("00" & Asc(Mid(Data, i, 1)), 3)
Next

For i = 1 To Len(ASCII) Step 3 ' 转16进制
ToHex = ToHex & Right("0" & Hex(CInt(Mid(ASCII, i, 3))), 2)
Next
ASCII = ToHex

ToHex = ""

For i = 1 To Len(ASCII) ' 倒序并+1
Num = CInt("&H" & Mid(ASCII, i, 1)) ' 逐位倒序
If Num >= 0 And Num <= 9 Then ' 9->0,其他+1
Num = Num + 1
If Num > 9 Then Num = 0
End If
ToHex = Hex(Num) & ToHex ' 转回16进制
Next
End Function

Function HexTo(Data) ' 还原
Dim Msg, Num, i
Msg = "": HexTo = "": Num = 0

For i = 1 To Len(Data) ' 倒序并-1
Num = CInt("&H" & Mid(Data, i, 1)) ' 逐位倒序
If Num <= 9 Then ' 0->9,其他-1
Num = Num - 1
If Num < 0 Then Num = 9
End If
Msg = Hex(Num) & Msg ' 转回16进制
Next

For i = 1 To Len(Msg) Step 2 ' 转10进制
HexTo = HexTo & Right("00" & CInt("&H" & Mid(Msg, i, 2)), 3)
Next

Msg = ""

For i = 1 To Len(HexTo) Step 3 ' 将ANSI码转数据
Msg = Msg & Chr(Mid(HexTo, i, 3))
Next
HexTo = Msg
End Function

根据计算机全名生成特征码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
' 根据计算机全名生成特征码(不可逆)
' Version: 1.0
' Date: 2018-3-28
' Author: Heom

Option Explicit

Dim WMI, Computer, Computers, ComputerName, Name, i, R, emmm

Set WMI = GetObject("winmgmts:\\.\root\cimv2")
Set Computers = WMI.ExecQuery("Select * from Win32_ComputerSystem")

For Each Computer in Computers ' 取计算机全名
ComputerName = Computer.Name
Exit For
Next

For i = 1 To Len(ComputerName) ' 将全名转ANSI码
Name = Name & Asc(Mid(ComputerName, i, 1))/2
Next

Name = PassWord(Replace(Name, ".", "")) ' 16位特征码

If Eval(Name) = 0 Then ' 如果计算器全名的ANSI码是0,则生成一个随机数
Randomize
Name = Int((666666 - 8888888 + 1) * Rnd + 8888888)
R = True
End If

If R Then
emmm = InputBox("16位特征识别码(随机),请妥善保管", "", ToHex(Name))
Else
emmm = InputBox("16位特征识别码,请妥善保管", "", ToHex(Name))
End If

emmm = InputBox("对应的16位密码", "", ToHex(PassWord(Name)))

' <!----上方是识别码,下方是加密算法---->

Function PassWord(Data) ' 这东西貌似是不可逆的...
Dim PWBuckup, PWPlus
PassWord = Data

If Len(PassWord) = 16 Then ' 初始化 避免生成相同值
PassWord = Mid(PassWord, 4, 8) & Mid(PassWord, 8, 4)
End If

Dim i: i = 16 ' 初始化
Do ' 加密
If Len(PassWord) > 16 Then
Do
PWBuckup = PassWord
PassWord = Mid(PWBuckup, i, 16)
PassWord = PassWord+PWPlus
PWPlus = PassWord
If i > Len(PassWord) Then
PassWord = Mid(PassWord, 1, 16)
Exit Do
Else
i = i*2
End If
Loop
End If

Do
If Len(PassWord) < 16 Then
PassWord = PassWord & Int(CCur(PassWord)/2)
Else
Exit Do
End If
Loop

If Len(PassWord) = 16 Then
Exit Do
End If
Loop
End Function

Function ToHex(Data) ' 加密
ToHex = ""
For i = 1 To Len(Data) Step 2
ToHex = ToHex & Right("0" & Hex(CInt(Mid(Data, i, 2))), 2)
Next
End Function

Function HexTo(Data) ' 还原
HexTo = ""
For i = 1 To Len(Data) Step 2
HexTo = HexTo & Right("0" & CInt("&H" & Mid(Data, i, 2)), 2)
Next
End Function

汉字转拼音

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
On Error Resume Next
Set d = createObject("Scripting.Dictionary")
d.add "a",-20319
d.add "ai",-20317
d.add "an",-20304
d.add "ang",-20295
d.add "ao",-20292
d.add "ba",-20283
d.add "bai",-20265
d.add "ban",-20257
d.add "bang",-20242
d.add "bao",-20230
d.add "bei",-20051
d.add "ben",-20036
d.add "beng",-20032
d.add "bi",-20026
d.add "bian",-20002
d.add "biao",-19990
d.add "bie",-19986
d.add "bin",-19982
d.add "bing",-19976
d.add "bo",-19805
d.add "bu",-19784
d.add "ca",-19775
d.add "cai",-19774
d.add "can",-19763
d.add "cang",-19756
d.add "cao",-19751
d.add "ce",-19746
d.add "ceng",-19741
d.add "cha",-19739
d.add "chai",-19728
d.add "chan",-19725
d.add "chang",-19715
d.add "chao",-19540
d.add "che",-19531
d.add "chen",-19525
d.add "cheng",-19515
d.add "chi",-19500
d.add "chong",-19484
d.add "chou",-19479
d.add "chu",-19467
d.add "chuai",-19289
d.add "chuan",-19288
d.add "chuang",-19281
d.add "chui",-19275
d.add "chun",-19270
d.add "chuo",-19263
d.add "ci",-19261
d.add "cong",-19249
d.add "cou",-19243
d.add "cu",-19242
d.add "cuan",-19238
d.add "cui",-19235
d.add "cun",-19227
d.add "cuo",-19224
d.add "da",-19218
d.add "dai",-19212
d.add "dan",-19038
d.add "dang",-19023
d.add "dao",-19018
d.add "de",-19006
d.add "deng",-19003
d.add "di",-18996
d.add "dian",-18977
d.add "diao",-18961
d.add "die",-18952
d.add "ding",-18783
d.add "diu",-18774
d.add "dong",-18773
d.add "dou",-18763
d.add "du",-18756
d.add "duan",-18741
d.add "dui",-18735
d.add "dun",-18731
d.add "duo",-18722
d.add "e",-18710
d.add "en",-18697
d.add "er",-18696
d.add "fa",-18526
d.add "fan",-18518
d.add "fang",-18501
d.add "fei",-18490
d.add "fen",-18478
d.add "feng",-18463
d.add "fo",-18448
d.add "fou",-18447
d.add "fu",-18446
d.add "ga",-18239
d.add "gai",-18237
d.add "gan",-18231
d.add "gang",-18220
d.add "gao",-18211
d.add "ge",-18201
d.add "gei",-18184
d.add "gen",-18183
d.add "geng",-18181
d.add "gong",-18012
d.add "gou",-17997
d.add "gu",-17988
d.add "gua",-17970
d.add "guai",-17964
d.add "guan",-17961
d.add "guang",-17950
d.add "gui",-17947
d.add "gun",-17931
d.add "guo",-17928
d.add "ha",-17922
d.add "hai",-17759
d.add "han",-17752
d.add "hang",-17733
d.add "hao",-17730
d.add "he",-17721
d.add "hei",-17703
d.add "hen",-17701
d.add "heng",-17697
d.add "hong",-17692
d.add "hou",-17683
d.add "hu",-17676
d.add "hua",-17496
d.add "huai",-17487
d.add "huan",-17482
d.add "huang",-17468
d.add "hui",-17454
d.add "hun",-17433
d.add "huo",-17427
d.add "ji",-17417
d.add "jia",-17202
d.add "jian",-17185
d.add "jiang",-16983
d.add "jiao",-16970
d.add "jie",-16942
d.add "jin",-16915
d.add "jing",-16733
d.add "jiong",-16708
d.add "jiu",-16706
d.add "ju",-16689
d.add "juan",-16664
d.add "jue",-16657
d.add "jun",-16647
d.add "ka",-16474
d.add "kai",-16470
d.add "kan",-16465
d.add "kang",-16459
d.add "kao",-16452
d.add "ke",-16448
d.add "ken",-16433
d.add "keng",-16429
d.add "kong",-16427
d.add "kou",-16423
d.add "ku",-16419
d.add "kua",-16412
d.add "kuai",-16407
d.add "kuan",-16403
d.add "kuang",-16401
d.add "kui",-16393
d.add "kun",-16220
d.add "kuo",-16216
d.add "la",-16212
d.add "lai",-16205
d.add "lan",-16202
d.add "lang",-16187
d.add "lao",-16180
d.add "le",-16171
d.add "lei",-16169
d.add "leng",-16158
d.add "li",-16155
d.add "lia",-15959
d.add "lian",-15958
d.add "liang",-15944
d.add "liao",-15933
d.add "lie",-15920
d.add "lin",-15915
d.add "ling",-15903
d.add "liu",-15889
d.add "long",-15878
d.add "lou",-15707
d.add "lu",-15701
d.add "lv",-15681
d.add "luan",-15667
d.add "lue",-15661
d.add "lun",-15659
d.add "luo",-15652
d.add "ma",-15640
d.add "mai",-15631
d.add "man",-15625
d.add "mang",-15454
d.add "mao",-15448
d.add "me",-15436
d.add "mei",-15435
d.add "men",-15419
d.add "meng",-15416
d.add "mi",-15408
d.add "mian",-15394
d.add "miao",-15385
d.add "mie",-15377
d.add "min",-15375
d.add "ming",-15369
d.add "miu",-15363
d.add "mo",-15362
d.add "mou",-15183
d.add "mu",-15180
d.add "na",-15165
d.add "nai",-15158
d.add "nan",-15153
d.add "nang",-15150
d.add "nao",-15149
d.add "ne",-15144
d.add "nei",-15143
d.add "nen",-15141
d.add "neng",-15140
d.add "ni",-15139
d.add "nian",-15128
d.add "niang",-15121
d.add "niao",-15119
d.add "nie",-15117
d.add "nin",-15110
d.add "ning",-15109
d.add "niu",-14941
d.add "nong",-14937
d.add "nu",-14933
d.add "nv",-14930
d.add "nuan",-14929
d.add "nue",-14928
d.add "nuo",-14926
d.add "o",-14922
d.add "ou",-14921
d.add "pa",-14914
d.add "pai",-14908
d.add "pan",-14902
d.add "pang",-14894
d.add "pao",-14889
d.add "pei",-14882
d.add "pen",-14873
d.add "peng",-14871
d.add "pi",-14857
d.add "pian",-14678
d.add "piao",-14674
d.add "pie",-14670
d.add "pin",-14668
d.add "ping",-14663
d.add "po",-14654
d.add "pu",-14645
d.add "qi",-14630
d.add "qia",-14594
d.add "qian",-14429
d.add "qiang",-14407
d.add "qiao",-14399
d.add "qie",-14384
d.add "qin",-14379
d.add "qing",-14368
d.add "qiong",-14355
d.add "qiu",-14353
d.add "qu",-14345
d.add "quan",-14170
d.add "que",-14159
d.add "qun",-14151
d.add "ran",-14149
d.add "rang",-14145
d.add "rao",-14140
d.add "re",-14137
d.add "ren",-14135
d.add "reng",-14125
d.add "ri",-14123
d.add "rong",-14122
d.add "rou",-14112
d.add "ru",-14109
d.add "ruan",-14099
d.add "rui",-14097
d.add "run",-14094
d.add "ruo",-14092
d.add "sa",-14090
d.add "sai",-14087
d.add "san",-14083
d.add "sang",-13917
d.add "sao",-13914
d.add "se",-13910
d.add "sen",-13907
d.add "seng",-13906
d.add "sha",-13905
d.add "shai",-13896
d.add "shan",-13894
d.add "shang",-13878
d.add "shao",-13870
d.add "she",-13859
d.add "shen",-13847
d.add "sheng",-13831
d.add "shi",-13658
d.add "shou",-13611
d.add "shu",-13601
d.add "shua",-13406
d.add "shuai",-13404
d.add "shuan",-13400
d.add "shuang",-13398
d.add "shui",-13395
d.add "shun",-13391
d.add "shuo",-13387
d.add "si",-13383
d.add "song",-13367
d.add "sou",-13359
d.add "su",-13356
d.add "suan",-13343
d.add "sui",-13340
d.add "sun",-13329
d.add "suo",-13326
d.add "ta",-13318
d.add "tai",-13147
d.add "tan",-13138
d.add "tang",-13120
d.add "tao",-13107
d.add "te",-13096
d.add "teng",-13095
d.add "ti",-13091
d.add "tian",-13076
d.add "tiao",-13068
d.add "tie",-13063
d.add "ting",-13060
d.add "tong",-12888
d.add "tou",-12875
d.add "tu",-12871
d.add "tuan",-12860
d.add "tui",-12858
d.add "tun",-12852
d.add "tuo",-12849
d.add "wa",-12838
d.add "wai",-12831
d.add "wan",-12829
d.add "wang",-12812
d.add "wei",-12802
d.add "wen",-12607
d.add "weng",-12597
d.add "wo",-12594
d.add "wu",-12585
d.add "xi",-12556
d.add "xia",-12359
d.add "xian",-12346
d.add "xiang",-12320
d.add "xiao",-12300
d.add "xie",-12120
d.add "xin",-12099
d.add "xing",-12089
d.add "xiong",-12074
d.add "xiu",-12067
d.add "xu",-12058
d.add "xuan",-12039
d.add "xue",-11867
d.add "xun",-11861
d.add "ya",-11847
d.add "yan",-11831
d.add "yang",-11798
d.add "yao",-11781
d.add "ye",-11604
d.add "yi",-11589
d.add "yin",-11536
d.add "ying",-11358
d.add "yo",-11340
d.add "yong",-11339
d.add "you",-11324
d.add "yu",-11303
d.add "yuan",-11097
d.add "yue",-11077
d.add "yun",-11067
d.add "za",-11055
d.add "zai",-11052
d.add "zan",-11045
d.add "zang",-11041
d.add "zao",-11038
d.add "ze",-11024
d.add "zei",-11020
d.add "zen",-11019
d.add "zeng",-11018
d.add "zha",-11014
d.add "zhai",-10838
d.add "zhan",-10832
d.add "zhang",-10815
d.add "zhao",-10800
d.add "zhe",-10790
d.add "zhen",-10780
d.add "zheng",-10764
d.add "zhi",-10587
d.add "zhong",-10544
d.add "zhou",-10533
d.add "zhu",-10519
d.add "zhua",-10331
d.add "zhuai",-10329
d.add "zhuan",-10328
d.add "zhuang",-10322
d.add "zhui",-10315
d.add "zhun",-10309
d.add "zhuo",-10307
d.add "zi",-10296
d.add "zong",-10281
d.add "zou",-10274
d.add "zu",-10270
d.add "zuan",-10262
d.add "zui",-10260
d.add "zun",-10256
d.add "zuo",-10254

function g(num)
if num>0 and num<160 then
g=chr(num)
else
if num<-20319 or num>-10247 then
g=""
else
a=d.Items
b=d.keys
for i=d.count-1 to 0 step -1
if a(i)<=num then exit for
next
g=b(i)
end if
end if
end function

function c(str)
c=""
for i=1 to len(str)
c=c&g(asc(mid(str,i,1)))
next
end function
while ex<>"exit"
ex=inputbox(c(ex),"汉字转拼音,输入汉字",ex)
if ex="" then
wscript.quit
end if
wend

×

纯属好玩

扫码支持
扫码打赏,你说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

文章目录
  1. 1. 让电脑说话
  2. 2. 结束电脑进程
  3. 3. 打开网址
  4. 4. 发送邮件
  5. 5. 阻止打开某进程
  6. 6. 添加桌面快捷方式
  7. 7. 直接关机
  8. 8. 无限语音报数
  9. 9. 无限弹光驱
  10. 10. 整人
  11. 11. 一键停止wscript.exe可以停止所有vbs进程
  12. 12. 简易数据加密
  13. 13. 根据计算机全名生成特征码
  14. 14. 汉字转拼音