【问题标题】:Combining multiple lines of telnet into 1 batch file将多行telnet合并为1个批处理文件
【发布时间】:2013-07-24 09:30:56
【问题描述】:

要执行特定任务,我必须执行以下命令

telnet 10.0.0.192 *hit enter
y (answer yes to whatever question comes up) *hit enter
DOMAIN\username (when prompted for username) *hit enter
password (when prompted for password) *hit enter
\\10.0.0.2\path\batchFile.bat (this is the batch file I'd like to run in the end) *hit neter

有没有一种方法可以将所有这些数据合并到一个批处理文件中(将密码保存在其中就可以了),这样我只需双击批处理文件并最终在远程服务器上执行batchFile.bat

【问题讨论】:

    标签: batch-file telnet


    【解决方案1】:

    这是一个可编写脚本的 telnet 客户端,可以在批处理文件中启动。谷歌。

    Telnet 脚本工具 v.1.0
    艾伯特·耶鲁

    【讨论】:

      【解决方案2】:

      不可能使用批处理文件完全自动执行此操作。但是,您可以使用 VBS 脚本之类的东西来管理会话。以下是此类脚本的示例(在本示例中称为 DoTelnet.vbs):

          Set myShell = CreateObject("WScript.Shell")
          myShell.run "cmd"
          WScript.Sleep 100
      
          myShell.SendKeys"telnet 127.0.0.1"
          myShell.SendKeys("{Enter}")
          WScript.Sleep 100
      
      etc...
      

      然后你可以从你的批处理文件中调用它:

      cscript DoTelnet.vbs
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-05-05
        • 2013-10-10
        • 2012-03-11
        • 2012-12-18
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多