如何自动传递用户输入使用plink.exe [英] How to pass user input automatically using plink.exe
问题描述
我需要使用密码来登录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 *****
我
下面我值能够登录,现在我需要做的就是输入:
I am able to login, now what I need to do is enter below values:
- 请选择帐户登录:U
- preSS 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
这似乎并不奏效。
展望:传递所有的用户输入,即U,RETURN......使用的Plink或任何其他的PuTTY工具
Expectation: Passing all the user input i.e. "U", "RETURN" .... using Plink or any other PuTTY tool.
鸭preciate您的帮助!
Appreciate your help!
推荐答案
的 -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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!