[英]Entering a password using System.Diagnostics.Process
I have created a new instance of the System.Diagnostics.Process
class. 我已经创建了System.Diagnostics.Process
类的新实例。
The StartInfo.Filename
property is the name of my command line application ( OpenSSL.exe
). StartInfo.Filename
属性是我的命令行应用程序( OpenSSL.exe
)的名称。 I can use StandardInput.WriteLine
to send commands to this application. 我可以使用StandardInput.WriteLine
将命令发送到此应用程序。 This works fine until I reach the point where I am asked for a password, in which case StandardInput.WriteLine
doesn't do anything. 这工作正常,直到我达到要求输入密码的程度,在这种情况下, StandardInput.WriteLine
不执行任何操作。
What am I doing wrong here? 我在这做错了什么?
我解决了这个问题,我添加了对System.Windows.Forms
的引用,然后使用SendKeys.SendWait
将我的密码的每个字母发送到应用程序,然后输入Enter键。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.