Skip to content Skip to sidebar Skip to footer

Automatic Login To A Website On Windows 7/chrome Via Batch File

I have a batch file. I have case select. if user types 26 it will open link 1 chrome. if user types 27 it will open link 2 in chrome. But I still can't figure out, how can I make b

Solution 1:

You can try the following code:

set WshShell = WScript.CreateObject("WScript.Shell")
call WshShell.Run("http://www.gmail.com", 1, false) 'This will open your default browser

WScript.Sleep 2000
WshShell.SendKeys "username"
WScript.Sleep 1000
WshShell.SendKeys "{TAB}"
WScript.Sleep 1000
WshShell.SendKeys "password"
WshShell.SendKeys "{TAB}"
WScript.Sleep 1000
WshShell.SendKeys "{ENTER}"
WScript.Quit()

The code opens your browser, waits for the page to load, and then enters the username and password assuming that the cursor is in the right input box (for example, in Gmail, it will be on the username input box). Else you have to navigate to the right input box by using TAB.

If you are against writing the password in the script file, save it on you browser and use the appropriate SendKeys method for logging in.

Solution 2:

i tried above script for my website, but only able to see login page not able to put user name and password, need help

@if (@CodeSection == @Batch) @then@echo off

set SendKeys=CScript //nologo //C:JScript "%~F0"
START iexplore.exe "www.gmail.com"
timeout /t 5
%SendKey% "USERNAME{TAB}"
%SendKey% "PASSWORD{Continue}"goto :EOF


@end// JScript section

var WshShell = WScript.CreateObject("WScript.Shell");
WshShell.SendKeys(WScript.Arguments(0))

Post a Comment for "Automatic Login To A Website On Windows 7/chrome Via Batch File"