当我尝试在 Windows ( )can't set "::exp::winnt_debug": parent namespace doesn't exist
上使用期望解释器的 C 实现运行我的期望脚本时,我收到错误“ ”。expect543.dll
但是,如果我通过 ActiveState 命令tclsh运行相同的脚本...
脚本中的“”语句set ::exp::winnt_debug 1
是错误的原因。知道可能是什么原因以及如何解决它?
请在下面找到代码
package require Expect
set ::exp::winnt_debug 1
set prompt "R4#"
set more " --More--"
expect -timeout 10 "$prompt"
set output [open result.txt "w"]
set running 1
spawn plink -telnet "144.21.12.45" -P 2004
send "enable\r"
send "\r"
send "show running-config\r"
send "\r"
while { $running > 0 } {
expect {
"\n" { puts -nonewline $output "$expect_out(buffer)" }
"$more" {send " "}
"lines *-* " { send " " }
#"$prompt" { set running 0 }
eof { set running 0 }
timeout { set running 0 }
}
}
puts "output is .."