Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Trying to create a batch file to open and login to a webpage.
The opening of the web page is easy, IE is default browser so cmd line is:
Start http://www.*********.com
The bit I cant find info on is logging in.
Is it possible to login using a batch file?
Any advice appreciated,
Thanks
??

You need to use VBScript and the SendKeys function. Do a google search for these two terms and you'll find lots of information on how to use them.

VBScript's SendKeys should be used as a last resort. VBS can use IE's ActiveX controls to do the work, so that should be used instead.
But unless you can type in an address that'll log you in, you cannot do what you want from Command Script.

get a better language that can support HTTP queries. See here: http://www.voidspace.org.uk/python/...
and here : http://www.voidspace.org.uk/python/...
for Python references. Similarly for Perl, you can use modules like LWP etc. Forget about using batch for what you are doing.

Ghostdog,
Python and Perl libraries can fetch URLs with proper authentication, but what if you actually want to view the page, not just parse it?

klint, it depends on what you mean by "view" the page. most simply, save the page as html, and call the browser to view it.
eg snippet for Python
import urllib2,os
url = "http://www.google.com"
page=urllib2.urlopen(url)
f=open("google.html","w")
f.write(page.read())
f.close()
os.system("firefox google.html")or another way is to just simple use the webbrowser module
import webbrowser
url="http://www.google.com"
webbrowser.open(url)

If the person is sitting at the computer and wants to view the page, it doesn't make any sense to me to use a script to load the page and login. But if that's what's wanted, then there is a Perl module that will do it.
Win32::IEAutomation
http://search.cpan.org/~prashant/Wi...

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |