如果我想覆盖现有的SSH密钥文件而不输入y,那么我将在bash中执行以下操作:
echo "y" | ssh-keygen -f /home/wakatana/id_rsa -N ""
如何使用PowerShell实现相同目的?我试过以下:
Write-Host "y" | ssh-keygen.exe -f C:\Users\wakatana\Desktop\id_rsa -N """"
它不会显示
Overwrite (y/n)?
对话框,但不会重写现有密钥。问题是什么? 最佳答案
尝试使用Write-Output
而不是Write-Host
:
Write-Output "y" | ssh-keygen.exe -f .\test -N "blahblah"