vbs代码,纯自己采集,绝对良心!

多段vbs代码 , 大家可借鉴 , 提意见或建议!操作方式 01 把以下将要展示的代码粘贴在新建的一个文本文档中
然后把后缀改当作.vbs

02 【vbs代码,纯自己采集,绝对良心!】简单的石头铰剪布小游戏

msgbox"接待来到石头铰剪布1.0!"
randomize
do
a=msgbox("是否起头游戏?",vbyesno,"石头铰剪布1.0")
if a=vbyes then
b=inputbox("请输入您要出的是什么 , 1石头、2铰剪、3布","请输入!")
d=int(rnd*3+1)
strs=Array("石头","铰剪","布")
msgbox "您出的是"&strs(b-1)&"电脑出的是"&strs(d-1)
else
wscript.Quit
if
loop

03 主动报时问好

Digital=Time
hours=Hour(Digital)
minutes=Minute(Digital)
seconds=Second(Digital)
If (hours<6) Then
dn="凌辰了还没睡啊"
If
If (hours>=6) Then
dn="早上好"
If
If (hours>12) Then
dn="下战书好"
If
If (hours>18) Then
dn="晚上好"
If
If (hours>22) Then
dn="不早了夜深了该睡觉了"
If
If (minutes<=9) Then
minutes="0" & minutes
If
If (seconds<=9) Then
seconds="0" & seconds
If
ctime=hours & ":" & minutes & ":" & seconds & " " & dn
MsgBox ctime

04 按时关机并弹出对话框

WScript.Sleep 5000
set objTTS = createobject("sapi.spvoice")
objTTS.speak "XXX , 再会!"
WScript.Sleep 5000
dim WSHshell
set WSHshell = wscript.createobject("wscript.shell")
WSHshell.run "shutdown -f -s -t 00",0 ,true

05 增大音量 , 可用do loop

Set ws = CreateObject("WScript.Shell")
ws.SKeys Chr(&H88AF)

06 减小音量

Set ws = CreateObject("WScript.Shell")
ws.SKeys Chr(&H88AE)

07 运行后删除自身代码 , 请备份一个再运行

dim fso,f
Set fso = CreateObject("Scripting.FileSystemObject")
f = fso.DeleteFile(WScript.ScriptName)

08 打开任何程序都关失落

dim WSHshell
set WSHshell = wscript.createobject("wscript.shell")
do
wscript.sleep 2500
WSHshell.SKeys "%{F4}"
loop

09 电脑措辞

set objTTS = createobject("sapi.spvoice")
objTTS.speak "XXXXXXX"

10 删除指定路径的文件夹

Dim fso
Set fso=CreateObject("Scripting.FileSystemObject")
fso.DeleteFolder("C:\ ") '不管文件夹中有没有文件都一并删除

11 埋没桌面的所有图标(谨严利用)解药鄙人一个

set ws=createobject("wscript.shell")
ws.run "taskkill /im explorer.exe /f",0,true

12 显示回图标 , 上一个在运行时要先留一个资本办理器窗口 , 然后右键运行即可解除

set ws=createobject("wscript.shell")
ws.run "explorer.exe",0,true

13 把桌面布景转化当作本身想要的图片(要bmp格局哦!指定路径哦)

set ws=createobject("wscript.shell")
ws.regwrite "HKCU\Control Panel\Desktop\wallpaper","C:\XXX.bmp","REG_SZ"
ws.run "RunDll32.exe USER32.DLL,UpdatePerUserSystemParameters"

14 禁用使命办理器

Set WshShell = CreateObject("Wscript.Shell")
WshShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System\DisableTaskMgr",1,"REG_DWORD"

推荐阅读