[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

[网络连接] bat可以制作自动打开网址,输入密码吗?

想自动登入一个网站,自已跳转页面,并选择

回复 6# dos-a


    别人说chatgpd的写代码能力在下降是真的
还说“因为密码是以明文形式存储在bat文件中的”危险 我看sendkeys自己最危险
你好

TOP

他这个应该是gpt给的

TOP

回复 4# apeng1


    怎么能用sendkeys呢 你在害人
你好

TOP

是的,可以使用bat来实现自动打开网址,并输入密码的操作。需要注意的是,这种方法并不安全,因为密码是以明文形式存储在bat文件中的。
以下是一个示例代码,可以打开Chrome浏览器并自动输入用户名和密码进行登录:

@echo off

set url=https://www.example.com/login
set username=your_username
set password=your_password

start chrome %url%
ping localhost -n 3 > nul
echo.Set oShell = CreateObject("WScript.Shell") > temp.vbs
echo.WScript.Sleep 500 >> temp.vbs
echo.oShell.SendKeys "%{TAB}" >> temp.vbs
echo.WScript.Sleep 500 >> temp.vbs
echo.oShell.SendKeys "%{TAB}" >> temp.vbs
echo.WScript.Sleep 500 >> temp.vbs
echo.oShell.SendKeys "%{TAB}" >> temp.vbs
echo.WScript.Sleep 500 >> temp.vbs
echo.oShell.SendKeys "%{TAB}" >> temp.vbs
echo.WScript.Sleep 500 >> temp.vbs
echo.oShell.SendKeys "%{TAB}" >> temp.vbs
echo.WScript.Sleep 500 >> temp.vbs
echo.oShell.SendKeys "%{TAB}" >> temp.vbs
echo.WScript.Sleep 500 >> temp.vbs
echo.oShell.SendKeys "%{TAB}" >> temp.vbs
echo.WScript.Sleep 500 >> temp.vbs
echo.oShell.SendKeys "%{TAB}" >> temp.vbs
echo.WScript.Sleep 500 >> temp.vbs
echo.oShell.SendKeys "%{TAB}" >> temp.vbs
echo.WScript.Sleep 500 >> temp.vbs
echo.oShell.SendKeys "%{TAB}" >> temp.vbs
echo.WScript.Sleep 500 >> temp.vbs
echo.oShell.SendKeys "%{TAB}" >> temp.vbs
echo.WScript.Sleep 500 >> temp.vbs
echo.oShell.SendKeys "%{TAB}" >> temp.vbs
echo.WScript.Sleep 500 >> temp.vbs
echo.oShell.SendKeys "%{TAB}" >> temp.vbs
echo.WScript.Sleep 500 >> temp.vbs
echo.oShell.SendKeys "%{TAB}" >> temp.vbs
echo.WScript.Sleep 500 >> temp.vbs
echo.oShell.SendKeys "%{TAB}" >> temp.vbs
echo.WScript.Sleep 500 >> temp.vbs
echo.oShell.SendKeys "%{TAB}" >> temp.vbs
echo.WScript.Sleep 500 >> temp.vbs
echo.Set objShell = CreateObject("WScript.Shell") >> temp.vbs
echo.objShell.SendKeys "%{TAB}" >> temp.vbs
echo.WScript.Sleep 500 >> temp.vbs
echo.objShell.SendKeys "%{TAB}" >> temp.vbs
echo.WScript.Sleep 500 >> temp.vbs
echo.objShell.SendKeys "%{TAB}" >> temp.vbs
echo.WScript.Sleep 500 >> temp.vbs
echo.objShell.SendKeys "%{TAB}" >> temp.vbs
echo.WScript.Sleep 500 >> temp.vbs
echo.objShell.SendKeys "%{TAB}" >> temp.vbs
echo.WScript.Sleep 500 >> temp.vbs
echo.objShell.SendKeys "%{TAB}" >> temp.vbs
echo.WScript.Sleep 500 >> temp.vbs
echo.objShell.SendKeys "%{TAB}" >> temp.vbs
echo.WScript.Sleep 500 >> temp.vbs
echo.objShell.SendKeys "%{TAB}" >> temp.vbs
echo.WScript.Sleep 500 >> temp.vbs
echo.objShell.SendKeys "%{TAB}" >> temp.vbs
echo.WScript.Sleep 500 >> temp.vbs
echo.objShell.SendKeys "%{TAB}" >> temp.vbs
echo.WScript.Sleep 500 >> temp.vbs
echo.objShell.SendKeys "%{TAB}" >> temp.vbs
echo.WScript.Sleep 500 >> temp.vbs
echo.objShell.SendKeys "%{TAB}" >> temp.vbs
echo.WScript.Sleep 500 >> temp.vbs
echo.objShell.SendKeys "%{TAB}" >> temp.vbs
echo.WScript.Sleep 500 >> temp.vbs
echo.objShell.SendKeys "%{TAB}" >> temp.vbs
echo.WScript.Sleep 500 >> temp.vbs
echo.objShell.SendKeys "%{TAB}" >> temp.vbs
echo.WScript.Sleep 500 >> temp.vbs
echo.objShell.SendKeys "%{TAB}" >> temp.vbs
echo.WScript.Sleep 500 >> temp.vbs
echo.objShell.SendKeys "%{TAB}" >> temp.vbs
echo.WScript.Sleep 500 >> temp.vbs
echo.objShell.SendKeys "%{TAB}" >> temp.vbs
echo.WScript.Sleep 500 >> temp.vbs
echo.objShell.SendKeys "%{TAB}" >> temp.vbs
echo.WScript.Sleep 500 >> temp.vbs
echo.objShell.SendKeys "%{TAB}" >> temp.vbs
echo.WScript.Sleep 500 >> temp.vbs
echo.objShell.SendKeys "%{TAB}" >> temp.vbs
echo.WScript.Sleep 500 >> temp.vbs
echo.objShell.SendKeys "%{TAB}" >> temp.vbs
echo.WScript.Sleep 1000 >> temp.vbs
echo.objShell.SendKeys "%{DOWN}" >> temp.vbs
echo.WScript.Sleep 500 >> temp.vbs
echo.objShell.SendKeys "{ENTER}" >> temp.vbs
echo.WScript.Sleep 1500 >> temp.vbs
echo.objShell.SendKeys "%{TAB}" >> temp.vbs
echo.WScript.Sleep 500 >> temp.vbs
echo.objShell.SendKeys "%{TAB}" >> temp.vbs
echo.WScript.Sleep 500 >> temp.vbs
echo.objShell.SendKeys %username% >> temp.vbs
echo.WScript.Sleep 500 >> temp.vbs
echo.objShell.SendKeys "{TAB}" >> temp.vbs
echo.WScript.Sleep 500 >> temp.vbs
echo.objShell.SendKeys %password% >> temp.vbs
echo.WScript.Sleep 500 >> temp.vbs
echo.objShell.SendKeys "{ENTER}" >> temp.vbs
echo.WScript.Sleep 500 >> temp.vbs
cscript temp.vbs
del temp.vbs > nul
```

在上面的代码示例中,将网址、用户名和密码替换为实际的值。代码中使用了ping命令和VBS脚本来实现等待网页完全加载的操作,并通过SendKeys方法自动输入用户名和密码。最后,使用del命令删除生成的临时vbs文件。

需要注意的是,此脚本仅适用于Windows操作系统,并且需要安装Chrome浏览器。并且,这种方法不安全,因为密码以明文形式存储在bat文件中,在使用公共设备时请谨慎操作。

TOP

试试vbs?(只能ie)
你好

TOP

回复 1# 李超


不同的网站,不同的方法。建议给出你需要登录的真实网站地址。
我帮忙写的代码不需要付钱。如果一定要给,请在微信群或QQ群发给大家吧。
【微信公众号、微信群、QQ群】http://bbs.bathome.net/thread-3473-1-1.html
【支持批处理之家,加入VIP会员!】http://bbs.bathome.net/thread-67716-1-1.html

TOP

返回列表