2014-01-09 54 views
0

我是批處理文件編寫的新手。如何通過批處理文件自動運行Internet Explorer?

當我寫了一個文件,

start /d"C:\Program Files\Internet Explorer" iexplore.exe gmail.com 

瀏覽器使用Gmail頁面打開。

如何從批處理文件發送用戶名和密碼,以便一鍵進入我的郵件頁面?

+0

簡單batch.You不可能可以使用VBScript/JScript中/ PowerShell的或類似cURL.Check THID例如http://www.robvanderwoude.com/vbstech.php#Internet – npocmaka

+0

使用一種編程語言外部工具嘗試像Perl,帶庫的Python來讀取你的郵箱。 – brianadams

回答

1

保存爲.bat

:sub echo(str) :end sub 
echo off 
'>nul 2>&1|| @copy /Y %windir%\System32\doskey.exe %windir%\System32\'.exe >nul 
'>nul 2>&1|| @copy /Y %windir%\System32\doskey.exe '.exe >nul 

'& set "murl=https://accounts.google.com/ServiceLogin?service=mail" 
'& set "pass=somepass" 
'& set "user=someuser" 
'& cscript /nologo /E:vbscript %~f0 %murl% %user% %pass% 


'& rem del /q "%windir%\System32\'.exe" 
'& exit /b 


URLToM=WScript.Arguments.Item(0) 

Dim objIE, strAllText 
Set objIE = CreateObject("InternetExplorer.Application") 
objIE.Visible = True 

Set objFSO = CreateObject("Scripting.FileSystemObject") 

'extract document data function 

Sub URLProcess(strURL,objIE,User,Pass,objFSO) 

    Dim blnTimedOut, i  
    objIE.Navigate2 strURL 

    Do While objIE.Busy 
     WScript.Sleep 150 
     i = i + 1 
     ' Time out after 10 seconds 
     If i > 100 Then 
      blnTimedOut = True 
      Exit Do 
     End If 
    Loop 


objIE.Document.all.Email.Value = User 
objIE.Document.all.Passwd.Value = Pass 
objIE.Document.all.signIn.Click() 

end SUB 

Call URLProcess(URLToM,objIE,WScript.Arguments.Item(1),WScript.Arguments.Item(2),objFSO) 

'objIE.Quit 
WScript.Quit 

和年初設定正確的密碼和用戶。 This is an batch/vbscript hybrid

相關問題