简体   繁体   English

如何通过批处理文件自动执行Internet Explorer?

[英]How to automate Internet Explorer by a batch file?

I am new for batch file writing. 我是批处理文件编写的新手。

When I wrote a file, 我写文件的时候

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

browser opens with the gmail page. 浏览器随即打开gmail页面。

How to send username and password from the batch file so that I go to my mail page on one click ? 如何从批处理文件发送用户名和密码,以便一键进入我的邮件页面?

save this as .bat 将其另存为.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

and set a correct password and user at the beginning. 并在开始时设置正确的密码和用户。 This is an batch/vbscript hybrid 这是一个批处理/ vbscript混合

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM