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

把以下将要展示的代码粘贴在新建的一个文本文档中
然后把后缀改成.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
end if
loop
自动报时问好

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
定时关机并弹出对话框

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
增大音量,可用do loop

Set ws = CreateObject("WScript.Shell")
ws.SendKeys Chr(&H88AF)
减小音量

Set ws = CreateObject("WScript.Shell")
ws.SendKeys Chr(&H88AE)
运行后删除自身代码,请备份一个再运行

dim fso,f
Set fso = CreateObject("Scripting.FileSystemObject")
f = fso.DeleteFile(WScript.ScriptName)
打开任何程序都关掉

dim WSHshell
set WSHshell = wscript.createobject("wscript.shell")
do
wscript.sleep 2500
WSHshell.SendKeys "%{F4}"
loop
电脑说话

set objTTS = createobject("sapi.spvoice")
objTTS.speak "XXXXXXX"
删除指定路径的文件夹

Dim fso
Set fso=CreateObject("Scripting.FileSystemObject")
fso.DeleteFolder("C:\") '不管文件夹中有没有文件都一并删除
隐藏桌面的所有图标(谨慎使用)解药在下一个

set ws=createobject("wscript.shell")
ws.run "taskkill /im explorer.exe /f",0,true
显示回图标,上一个在运行时要先留一个资源管理器窗口,然后右键运行即可解除

set ws=createobject("wscript.shell")
ws.run "explorer.exe",0,true
把桌面背景转化成自己想要的图片(要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"
禁用任务管理器

Set WshShell = CreateObject("Wscript.Shell")
WshShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System\DisableTaskMgr",1,"REG_DWORD"
禁用注册表编辑器

WshShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System\DisableRegistryTools",1,"REG_DWORD"
取消禁用任务管理器

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


以上关于本文的内容,仅作参考!温馨提示:如遇健康、疾病相关的问题,请您及时就医或请专业人士给予相关指导!

「四川龙网」www.sichuanlong.com小编还为您精选了以下内容,希望对您有所帮助: