高手帮忙用vbs编一个按键盘动作的脚本!!!

2024-12-16 22:48:18
推荐回答(2个)
回答1:

以下是在Win98下自动安装还原精灵的脚本('后面的内容为注释):

Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.SendKeys "^{esc}" '调用开始菜单
WScript.Sleep 500
WshShell.SendKeys "r" '打开运行对话框
WScript.Sleep 500
WshShell.SendKeys "c:\h\setup.exe" '安装还原精灵(本来可直接用“WshShell.Run "c:\h\setup.exe"”,但那样会装成试用版!)
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 1000
WshShell.AppActivate "还原精灵21st DEMO" '当前窗口
WScript.Sleep 1000
WshShell.SendKeys "{ENTER}" '注册
WScript.Sleep 500
WshShell.SendKeys "q" '输入使用者
WScript.Sleep 500
WshShell.SendKeys "{TAB}" '移至注册码处
WScript.Sleep 500
WshShell.SendKeys "{q 20}" '输入注册码(20个"q")
WScript.Sleep 500
WshShell.SendKeys "{ENTER}" '确认注册码
WScript.Sleep 500
WshShell.SendKeys "{ENTER}" '确认谢谢
WScript.Sleep 500
WshShell.SendKeys "%A" '同意协议
WScript.Sleep 500
WshShell.SendKeys "%N" '是否多操作系统(单)
WScript.Sleep 500
WshShell.SendKeys "%N" '安装模式(c)
WScript.Sleep 500
WshShell.SendKeys "%U" '自定义保护
WScript.Sleep 500
WshShell.SendKeys "%N" '详细设置
WScript.Sleep 500
WshShell.SendKeys "{DOWN}" '移至C盘
WScript.Sleep 500
WshShell.SendKeys "{DOWN}" '移至D盘
WScript.Sleep 500
WshShell.SendKeys " " '不保护D盘
WScript.Sleep 500
WshShell.SendKeys "{DOWN}" '移至E盘
WScript.Sleep 500
WshShell.SendKeys " " '不保护E盘
WScript.Sleep 500
WshShell.SendKeys "{TAB}" '还原方式
WScript.Sleep 500
WshShell.SendKeys "%A" '自动还原
WScript.Sleep 500
WshShell.SendKeys "{TAB}" '移至设置密码处
WScript.Sleep 500
WshShell.SendKeys "a" '设置密码为"a"
WScript.Sleep 500
WshShell.SendKeys "{TAB}" '移至保护设置处
WScript.Sleep 500
WshShell.SendKeys "%I" '防I/O破坏
WScript.Sleep 1000
WshShell.SendKeys "%N" '再次确认密码
WScript.Sleep 1000
WshShell.SendKeys "a" '再次确认密码为"a"
WScript.Sleep 1000
WshShell.SendKeys "{ENTER}" '确认密码
WScript.Sleep 1000
WshShell.SendKeys "{ENTER}" '确认更改
WScript.Sleep 1000
WshShell.SendKeys "%N" '选择重启时间
WScript.Sleep 1000
WshShell.SendKeys "%N" '稍后重启
WScript.Sleep 1000
WshShell.SendKeys "%F" '完成
WScript.Sleep 1000
WshShell.RegDelete "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU\a" '删除运行记录c:\h\setup.exe
WshShell.RegDelete "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU\MRUList" '删除运行记录列表
WshShell.RegDelete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\HDDGMon" '在任务栏不显示还原精灵图标
Set WshShell = Nothing
Set FSO = CreateObject("Scripting.FileSystemObject")
fso.DeleteFolder "C:\WINDOWS\Start Menu\Programs\还原精灵21st DEMO",True '删除“开始菜单-程序”中的“还原精灵文件夹”
fso.DeleteFolder "C:\h",True '删除“C盘”中的“h文件夹”
fso.DeleteFile "C:\h.vbs",True '删除“C盘”中的“h.vbs文件
Set FSO = nothing

回答2:

用按键精灵就可以搞定了阿