VBS文件启动bat.file

时间:2012-06-02 01:13:51

标签: vbscript

我能够打开我的Gmail,但试图打开下一个网址a。我能这样做吗?怎么样?

需要修正一个(WshShell.Exec“C:\ test.bat”)

'Script starts here
Set WshShell = WScript.CreateObject("WScript.Shell")

'Wait 1 second (1000 ms)
WScript.Sleep 1000

'Open IE and go to gmail.com (your IExplore.exe file location may be different)
WshShell.Exec "C:\Program Files\Internet Explorer\IEXPLORE.EXE gmail.com"

'Allow time for IE to finish loading (about 15 secs for slow connections/machines)
WScript.Sleep 10000

'Send the login info in the login box
'login (change username to your login name
WshShell.Sendkeys "xxxxxxxxxx"
WScript.Sleep 500

'hit TAB key to move to password field
WshShell.Sendkeys "{TAB}"
WScript.Sleep 500

'Send the password info
'change your password to your login password
WshShell.Sendkeys "xxxxxxxxxxxxx"
WScript.Sleep 500

'Hit 'Enter' key to log-in
WshShell.Sendkeys "{ENTER}"
WScript.Sleep 10000

WshShell.Exec "C:\test.bat"

'Allow time for IE to finish loading (about 15 secs for slow connections/machines)
WScript.Sleep 15000

'Send the login info in the login box
'login (change username to your login name
WshShell.Sendkeys "xxxxxxxxx"
WScript.Sleep 500

'hit TAB key to move to password field
WshShell.Sendkeys "{TAB}"
WScript.Sleep 500

'Send the password info
'change your password to your login password
WshShell.Sendkeys "xxxxxxxx"
WScript.Sleep 500

'Hit 'Enter' key to log-in
WshShell.Sendkeys "{ENTER}"

1 个答案:

答案 0 :(得分:0)

编辑:这对我有用。

test.vbs

Set WshShell = WScript.CreateObject("WScript.Shell") 
WshShell.Exec "test.bat"

和test.bat

@echo off 
start www.yahoo.com