Batch command to open url and fulfill username and password
41,869
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 videos on Youtube
Comments
-
zed over 1 year
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).
-
BrianC about 8 yearsThe only way I know of is to pass it through the URL (e.g. user:[email protected]) if the site uses basic auth, but this is disabled by default in newer versions of IE/edge. Beyond that I think you're in saved password / add-on territory
-
root about 8 yearsIf you can get your batch file to send keystrokes I don't see why not. Depending on how the page is setup I would imagine you could open the page, send
Tab
until the cursor is in the username box, send the username, sendTab
again, send the password, sendEnter
. -
AFH about 8 yearsYou may be able to use
curl.exe
, which allows certain fields to be set. Otherwise, there is theSelenium
add-on for Firefox, but you won't easily be able to control this from a batch file. -
zed about 8 years@BrianC, that is no longer supported.
-
zed about 8 years@root, any example on how to do that?
-
zed about 8 years@AFH, any sample on curl? Can't use addons because the idea of this is to have a portable batch which could run from differents computers on the LAN
-
AFH about 8 yearsThere are plenty examples on the web if you search for "auto login with curl", including this video.
-
-
zed about 8 yearsThank you. This does not work since the login is not an html form, but a windows prompt instead, which opens up when you hit the website.
-
manjesh23 about 8 yearsI don't understand windows prompt.
-
zed about 8 yearsSorry, I mean that the login is a little window that pops up asking for username and password, which is not an html form but a browser window instead.
-
pbies almost 7 yearsUse
curl
: stackoverflow.com/questions/2594880/… -
Myanju about 6 yearsI used this but i am unable to login.