2012-06-02 28 views
1

我能打開我的Gmail,但試圖打開下一個網址a。我可以這樣做嗎?怎麼樣?VBS文件啓動bat.file

需要修復右一個(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}" 
+0

你會好得多直接腳本IE。它有自己的自動化對象。 – Nilpo

回答

0

編輯:這爲我工作。

test.vbs

​​

和test.bat的

@echo off 
start www.yahoo.com 
+0

感謝您的快速回復。我嘗試過,並沒有工作。 – DeafTimberWolf

+0

我創建了bat文件@echo off start/d https://我的url.com – DeafTimberWolf

+0

它確實執行了cmd.exe,但沒有打開其他url。我把開始http://yahoo.com bat文件。 VBS文件似乎有效,但不bat.file – DeafTimberWolf