Windows – Batch command to open url and fulfill username and password

batch filecmd.execommand linewindows

I'm currently opening a local url from batch command (.bat file) like this:

@echo off
start /d "C:\Program Files\Internet Explorer" IEXPLORE.EXE http://some_local_address:88

This is working fine.
The first thing that this site does is to ask for a username and password in a popup window.
Is it possible to pass this information (or at least username) from the .bat file itself, so it is auto-completed in the emerging login window?

(Note that I'm aware you can complete username and password the first time, and "remember credentials", I just want to know if this is possible to pass from command line and how).

Best Answer

I don't think this can be done using a batch file as batch has its own limitations, instead you can you the below VB script.

Set IE = CreateObject("InternetExplorer.Application")
IE.navigate "http://TheWebsite"
IE.Visible = True`

While IE.Busy
    WScript.Sleep 50
Wend

Set ipf = IE.document.all.username
ipf.Value = "Username" 
Set ipf = IE.document.all.password
ipf.Value = "Password" 
Set ipf = IE.document.all.Submit
ipf.Click 
IE.Quit

Update Website name, uname and passwd and then save this as AutoWebsite.vbs

Related Question