自动登录到网站上的Windows 7 /铬通过批处理文件 [英] Automatic login to a website on windows 7/Chrome via batch file

查看:266
本文介绍了自动登录到网站上的Windows 7 /铬通过批处理文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个批处理文件。我有选择的情况下。如果用户键入26它将打开链接1铬。
如果用户键入27,将在Chrome中打开链接2。

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 batch login automatically into website with username and password.

我看了关于谷歌这样一个剧本,但没有发现任何有用的东西。我了解了一下C ++,UNIX(也有的HTML和Java脚本)使用这些语言我不知道它是否能在Windows机器上进行,但即使这是可以做到,我认为VB相比恐怕很难或ç##或其他一些高级语言。

I looked for such a script on the google but didn't find anything useful. I know a bit of C++, unix,(also some html and java script) I don't know if it can be done on windows machine using these languages but even if it could be done I think it would be difficult compared to VB or C## or some other high level languages.

我学会了如何打开使用封闭在一个bat文件基本的Windows批处理命令多个站点,如:

I learned how to open multiple sites using basic windows batch commands enclosed in a bat file like:

start chrome.exe http://yahoo.com
start chrome.exe http://www.google.tv

但我仍然无法弄清楚如何将真正的bat文件点击会帮我登录到该网站还甚至没有键入用户名和密码。

But still I can't figure out how would actually a click on the bat file would help me to login to the sites also without even typing the username and password.

我需要开始学习VB(Visual Basic)中,点网或Windows批处理编程做this.is这使难治..请帮助。

Do I need to start learning VB(visual basic),dot net, or windows batch programming to do this.is this so dificult.. Please help.

推荐答案

您可以尝试以下code:

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()

在code打开你的浏览器等待页面加载,然后输入用户名和密码,假设光标在右边的输入框(比如,对​​于的Gmail 这将是在用户名输入框)。否则,你必须使用导航到合适的输入框中的标签

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 e.g. In Gmail it will be on the username input box). Else you have to navigate to the right input box by using TAB.

如果你反对在脚本文件编写密码。省省吧你的浏览器并使用适当的SendKeys方法为登录。

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.

希望这会适合您的需求。

Hope this suits your requirement.

这篇关于自动登录到网站上的Windows 7 /铬通过批处理文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆