每小时,我们学校的网络都需要通过输入用户名和密码重新连接。我们如何在任务计划程序中添加批处理文件来自动登录?
:start
ping -n 1000 127.0.0.1 > nul
REM call local html with the form info that will submit onload
goto start
用更大的数字替换 1000,因为您不能批量
wait
。这将向 localhost
发送 x 数量的 ping。做一些测试以获得接近一个小时的时间。
现在对于
html
文件,您可以将登录页面另存为 html,将 value="myUsername"
和 value="myPassword"
添加到右侧输入字段。
添加/使用表单的
name
将 <script>document.formName.submit();</script>
添加到文档的最后。
现在请记住,网站可能会验证
HTTP_REFERER
,在这种情况下,这将不起作用......
您还可以使用 vbscript 输入文本。
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "%windir%\notepad.exe"
WshShell.AppActivate "Notepad"
WshShell.SendKeys "Hello World"
我在最近的谷歌马拉松比赛中偶然发现了这份指南,它让我想起了你的问题! therevisionist.org 这是一个vbs,而不是一个批处理。希望它符合要求!
Option Explicit
Dim ie, ipf
Set ie = CreateObject("InternetExplorer.Application")
Sub WaitForLoad
Do While IE.Busy
WScript.Sleep 500
Loop
End Sub
ie.Left = 0
ie.Top = 0
ie.Toolbar = 0
ie.StatusBar = 0
ie.Height = 200
ie.Width = 1020
ie.Resizable = 0
ie.Navigate "https://www.exemple.com/"
Call WaitForLoad
ie.Visible = True
ie.Document.All.Item("email").Value="[email protected]"
ie.Document.All.Item("pass").Value="ThePassword"
ie.Document.All.Item("login_form").Submit
您可以使用我之前的答案定期致电
.vbs
。