问题描述
我需要使用密码登录到 SSH 会话,然后执行特定帐户的用户输入值.
I need to login to an SSH session using password, and then execute the user input values for a particular account.
例如:
PLINK.EXE -ssh ***** -l ***** -pw *****
我能够登录,现在我需要做的是输入以下值:
Iam able to login, now what I need to do is enter below values:
- 请选择要登录的帐户:U"
- 按 RETURN 继续或按 OFF 取消会话 - "RETURN"
同样需要这种用户输入.有没有办法将*"值存储在文本文件中并使用 Plink 加载它们.
There are similarly this kind of user inputs needed. Is there a way I store the "*" values in a text file and load them using Plink.
我试过了:
PLINK.EXE -ssh ***** -l ***** -pw ***** -m C:input.txt
这似乎不起作用.
期望:使用 Plink 或任何其他 PuTTY 工具传递所有用户输入,即U"、RETURN"…….
Expectation: Passing all the user input i.e. "U", "RETURN" .... using Plink or any other PuTTY tool.
感谢您的帮助!
推荐答案
-m
开关用于在 shell 中执行命令.您不能使用它来为执行的命令提供输入.
The -m
switch is used to execute commands in shell. You cannot use it to provide inputs for the executed commands.
但由于 Plink 是一个控制台应用程序,您可以使用输入重定向来提供输入:
But as Plink is a console application, you can use an input redirection to provide input:
plink.exe -ssh ... -l ... -pw ... < C:input.txt
这篇关于如何使用 plink.exe 自动传递用户输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!