TCL \ Expect :: Windows XP上运行的脚本不在Windows 7上运行. [英] TCL\Expect:: Script that is running on Windows XP is not running on Windows 7. Any ideas please?

查看:58
本文介绍了TCL \ Expect :: Windows XP上运行的脚本不在Windows 7上运行.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是我的TCL/期望脚本:

Following is my TCL/Expect Script:

package require Expect

spawn telnet 2.2.2.10

expect "*ogin:"
send "admin\r"
expect "*word:"
send "test\r"
expect "*>"
send "enable\r"
expect "*#"

以上脚本在"Windows XP"计算机上运行.但是,当我在"Windows 7"中运行相同的脚本时,它会引发以下错误:

The above script runs in "Windows XP" machine. But when I run this same script in "Windows 7", its throws following error:

C:\Users\test\Desktop>tclsh 3_AP_collect_sign.tcl
The system cannot find the file specified.
    while executing
"spawn telnet 2.2.2.10"
    (file "3_AP_collect_sign.tcl" line 6)

C:\Users\Symbol\Desktop>

请帮助我在"Windows 7"计算机上运行此脚本.我应该添加任何要在Windows 7中运行的东西吗?预先感谢.

Please help me to run this script in "Windows 7" machine. Should I add anything to run in Windows 7?. Thanks in Advance.

谢谢

Balu P.

推荐答案

问题是Windows 7中PATH上没有telnet.exe.您可能会发现PuTTY套件中的plink.exe选项)是可以接受的替代方法,但可能还有其他替代方法.

The problem is that there is no telnet.exe on your PATH in Windows 7. You may find that plink.exe from the PuTTY suite (with suitable options) is an acceptable replacement, but there are probably others too.

telnet.exe也可能存在,但被(系统)标记为不可能附加调试器(这是Expect在Windows的幕后真正起作用的方式;这是非常深刻的黑客,我不是发明人!)即使是这种情况,解决方法也一样:找到替代程序.

It's also possible that telnet.exe exists but is marked (by the system) as impossible to attach a debugger to (which is how Expect really works under the covers on Windows; this is very deep hackery and I'm not the inventor of it!) Even if that's the case, the fix is the same: find an alternative program.

也可以完全用Tcl代码模拟telnet,但是很多的工作是因为Telnet是一个相当混乱的协议,而终端仿真却非常烦人.不推荐的方法.

It's also possible to emulate telnet entirely in Tcl code, but a lot of work as Telnet is a pretty messy protocol and terminal emulation is grindingly annoying. Not a recommended approach.

这篇关于TCL \ Expect :: Windows XP上运行的脚本不在Windows 7上运行.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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