bat调用vbs脚本自动输入密码

原创
2017/01/26 09:53
阅读数 5.6K
@echo off
(echo set Wshell=CreateObject^("Wscript.Shell"^)
echo Wshell.AppActivate "taskeng.exe"
echo wscript.Sleep 2000
echo Wshell.SendKeys "123456{ENTER}"
echo Wshell.SendKeys "")>"%tmp%\inputpassword.vbs"
start "" "%tmp%\inputpassword.vbs"
mysqldump -P 3307 -h localhost -u root -p db1 >D:\database\db1.sql

(echo set Wshell=CreateObject^("Wscript.Shell"^)
echo Wshell.AppActivate "taskeng.exe"
echo wscript.Sleep 2000
echo Wshell.SendKeys "123456{ENTER}"
echo Wshell.SendKeys "")>"%tmp%\inputpassword.vbs"
start "" "%tmp%\inputpassword.vbs"
mysqldump -P 3307 -h localhost -u root -p db2>D:\database\db2.sql

(echo set Wshell=CreateObject^("Wscript.Shell"^)
echo Wshell.AppActivate "taskeng.exe"
echo wscript.Sleep 2000
echo Wshell.SendKeys "123456{ENTER}"
echo Wshell.SendKeys "")>"%tmp%\inputpassword.vbs"
start "" "%tmp%\inputpassword.vbs"
mysqldump -P 3307 -h localhost -u root -p db3 >D:\database\db3.sql

pause

该bat用windows定时任务调用的时候不会激活taskeng.exe,虽然设置了AppActivate 但是只有鼠标点击了才会自动输入密码

展开阅读全文
加载中
点击引领话题📣 发布并加入讨论🔥
打赏
0 评论
1 收藏
0
分享
返回顶部
顶部