Execute remote commands from Debian to Windows via Telnet

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-04 20:53:55

Just add one more expect statement at the end, like as follows,

send "$cmd\r"
expect "C:\Users\Administrateur>"

Basically, expect will work with two feasible commands such as send and expect. If send is used, then it is mandatory to have expect (in most of the cases) afterwards. (while the vice-versa is not required to be mandatory)

This is because without that we will be missing out what is happening in the spawned process as expect will assume that you simply need to send one string value and not expecting anything else from the session.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!