如何在DOS命令/C#(GPG)中模拟按键输入
我在 C# 中将 GPG 作为 DOS 命令执行。作品占多数。 我已经设法从标准输入读取密码(类似于此处编写的密码) )
但我一直坚持密钥删除,你需要执行以下命令:
gpg --delete-key "Key Name"
但问题是 GPG 会询问你是否确定要删除此密钥以及你
需要的是按 Y ENTER > 我无法存档的内容...
似乎它没有从 StdIO 读取
我尝试过类似 DOS 的解决方案
echo Y | gpg --delete-key "Key Name"
或制作 txt 文件,其中 Y 作为第一行并且 <输入>作为第二
type yes.txt | gpg --delete-key "Key Name"
个都不起作用...
知道如何让它工作吗?
I'm executing GPG as DOS commands in C#. Works in majority.
I've managed reading passwords from standard input (similarly to written here)
But I've stuck on keys deletion what you need is execute below command:
gpg --delete-key "Key Name"
But problem is GPG asks you if you are sure you want to delete this key and what you
need is press Y < ENTER > what I'm not able to archive...
Seems it doesn't read from StdIO
I've tried DOS-like solution
echo Y | gpg --delete-key "Key Name"
or making txt file with Y as 1st line and < Enter > as 2nd
type yes.txt | gpg --delete-key "Key Name"
Both didnt work...
Any idea how to make it working ??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试将
--yes
作为参数传递。来自 GPG 手册:
Try to pass
--yes
as a param.From the GPG manual: