search

Home  >  Q&A  >  body text

SecureCRT脚本(Python)中怎么获取串口发送命令的返回值?

使用SecureCRT连接串口,现需要使用脚本自动发送命令,但需要获取到所发命令的返回值,请问有什么方法可以实现? 在SecureCRT官网上有Python脚本的例子:http://www.vandyke.com/support/securecrt/scripts/getdata.py.txt 我按例子做了之后,并不能得到相应的结果。 promptString = "linux$" crt.Screen.WaitForString(promptString) 这两行代码过不去,应该是promptString这个值设置的有问题,请帮忙解决,谢谢。

高洛峰高洛峰2770 days ago761

reply all(2)I'll reply

  • PHP中文网

    PHP中文网2017-04-17 11:30:57

    It’s better to answer your own questions! I once asked this question entirely because I was not familiar with SecureCRT scripts, so I asked such a relatively low-level question. It seems now that I just didn't understand the variable PromptSrting at that time, so I couldn't get the desired results. Because the PromptSrting of the system I am using does not start with linux$, I cannot completely copy the example. Now after modifying this variable, everything is OK.

    reply
    0
  • 天蓬老师

    天蓬老师2017-04-17 11:30:57

    Have you tried using python to connect to the linux serial port via ssh?

    reply
    0
  • Cancelreply