【问题标题】:I want to run window cmd commands through perl from linux machine我想通过 Linux 机器上的 perl 运行窗口 cmd 命令
【发布时间】:2015-01-16 13:19:26
【问题描述】:
#!/usr/bin/perl

use Net::Telnet;

$telnet = new Net::Telnet ( Timeout=>10,Errmode=>'die');
$telnet->open('hostname.domainname');
print "opened ...\n";
$telnet->waitfor('/login: $/i');
$telnet->print('pjpandey');
print "enetered username ...\n";
$telnet->waitfor('/password: $/i');
$telnet->print('pjp2213');

*我收到这个错误

connecting to "hostname.domainname", port 23: Connection refused at ./login.pl line 6

我想从 linux VM 登录窗口机器并通过 perl 脚本在 cmd 中朗读命令(java -jar selenium.jar)。 你能用 telnet 或任何其他脚本语言以外的方式帮助我吗? 提前致谢!*

【问题讨论】:

  • 首先,您可能不希望那里有您的用户名和密码。如果不出意外,它会向所有人显示您使用的密码类型。其次,您可能没有在 windows 机器上运行 telnet 服务器。如果存在这样的东西,您必须安装它并确保它正在运行。不过,我对此无能为力。祝你好运,无论如何。

标签: linux perl cmd window


【解决方案1】:

我做类似的事情 RPC(远程过程调用)。 Windows 在这方面有着可怕的安全记录。您应该考虑使用 ssh 而不是 telnet。有了它,您将获得更多支持。

“如何在 Windows 机器上安装运行 ssh?”你问?

http://www.howtogeek.com/howto/41560/how-to-get-ssh-command-line-access-to-windows-7-using-cygwin/

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-08-09
    • 2016-06-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-10-16
    • 2021-05-18
    • 2016-06-03
    相关资源
    最近更新 更多