我试图找到如何使Telnet IP地址成为用户提供的变量。该脚本工作正常,但有许多主机地址,我必须运行此脚本。因为我每次使用它时都必须使用新的IP地址编辑文件。完整脚本包含许多已删除的Sendkeys条目。
job>
script language="VBScript">
Option Explicit
On Error Resume Next
Dim WshShell
set WshShell=CreateObject("WScript.Shell")
WshShell.run "cmd.exe"
WScript.Sleep 1000
WshShell.SendKeys "telnet 160.221.230.127"
WshShell.SendKeys ("{Enter}")
WScript.Sleep 1000
WshShell.SendKeys "user XXX XXX"
WshShell.SendKeys ("{Enter}")
WScript.Sleep 1000
WshShell.SendKeys "cci resetapb cancel"
WshShell.SendKeys ("{Enter}")
WScript.Sleep 1000
WScript.Quit
</script>
</job>
答案 0 :(得分:0)
您可以使用InputBox
dim res: res = InputBox("enter ip address", "?", "192.168.1.1")
msgbox res
参数是:
答案 1 :(得分:0)
使用此示例
Set WshShell = CreateObject("WScript.Shell")
ServerIP = InputBox ("Enter IP")
WshShell.Run ("telnet " & ServerIP)
WScript.Sleep(500)
WshShell.SendKeys("login~")
WScript.Sleep 100
WshShell.SendKeys("password~")
WScript.Sleep 100