对于需要与Shift、Ctrl、Alt三个控制键组合的按键,SendKeys使用特殊字符来表示:
Shift---------WshShell.SendKeys "+"
Ctrl---------WshShell.SendKeys "^"
Alt---------WshShell.SendKeys "%"
Dim mysqlshell,username,password
set mysqlshell = wscript.createobject("wscript.shell")
mysqlshell.run "cmd"
wscript.sleep 100
username=inputbox("请输入您的用户名:","四博互联MySql登陆脚本-作者:王永科")
do while username=""
username=inputbox("请输入您的用户名:","四博互联MySql登陆脚本-作者:王永科")
loop
if username <> "" then
password=inputbox("请输入您的密码:","四博互联MySql登陆脚本-作者:王永科")
do while password=""
password=inputbox("请输入您的密码:","四博互联MySql登陆脚本-作者:王永科")
loop
mysqlshell.sendkeys "mysql -u"
mysqlshell.sendkeys username
mysqlshell.sendkeys " -p"
mysqlshell.sendkeys password
wscript.sleep 100
mysqlshell.sendkeys "{enter}"
end if