【问题标题】:How to run Windows Telnet Client in PowerShell?如何在 PowerShell 中运行 Windows Telnet 客户端?
【发布时间】:2017-10-06 04:15:10
【问题描述】:

我在 Win 7 中安装了 telnet 客户端。现在我尝试在 PowerShell 中运行它。我需要这样做才能在远程主机中运行命令ewfmgr d: -commit。我用

Invoke-Command -ComputerName [MyComp] -scriptblock {cmd.exe /c "telnet"}

但什么也没发生。是否可以使用 CMD 运行 telnet 并传输参数(IP、用户名、密码、命令)?

我也试过了

Invoke-Command -Command {cmd.exe /c C:\Windows\System32\telnet.exe}

& "C:\Windows\System32\telnet.exe"

Invoke-Command -ScriptBlock {C:\Windows\System32\telnet.exe}

我尝试做同样的事情here

【问题讨论】:

  • 什么都没有发生,因为 Telnet 客户端是交互式程序。它等待用户输入。编写 Telnet 脚本很痛苦,您可以使用 SSH 代替吗?
  • 如果您必须使用 telnet,至少使用实际上是可编写脚本的 telnet 客户端,例如plink 来自PuTTY suite

标签: powershell cmd telnet


【解决方案1】:

您可以使用 Invoke-Item 从 PowerShell 打开 telnet 客户端,例如:

Invoke-Item "C:\Windows\System32\telnet.exe"

start-sleep 5

【讨论】:

    猜你喜欢
    • 2012-09-03
    • 1970-01-01
    • 2022-07-09
    • 2013-02-15
    • 2014-12-03
    • 2013-12-26
    • 2023-02-22
    • 2014-11-19
    • 2020-06-06
    相关资源
    最近更新 更多