![Pageant - 报告错误“无法打开文件”,但仍然加载密钥](https://linux22.com/image/1603780/Pageant%20-%20%E6%8A%A5%E5%91%8A%E9%94%99%E8%AF%AF%E2%80%9C%E6%97%A0%E6%B3%95%E6%89%93%E5%BC%80%E6%96%87%E4%BB%B6%E2%80%9D%EF%BC%8C%E4%BD%86%E4%BB%8D%E7%84%B6%E5%8A%A0%E8%BD%BD%E5%AF%86%E9%92%A5.png)
我正在使用 Pageant 0.70 通过 PowerShell 脚本在 Windows 10 上加载密钥:
配置文件.ps1
$pageant-path = "c:\full-path-to-pageant.exe"
$keypath1 = c:\full-path-to-key1
$keypath2 = c:\full-path-to-key2
$keypath3 = c:\full-path-to-key3
初始化文件
# sourcing from profile
. profile-file.ps1
# load keys - doing this because keys are in different locations and paths are too long to have in one spot
& $pageantpath -a "$keypath1"
& $pageantpath -a "$keypath2"
& $pageantpath -a "$keypath3"
当 Pageant 命令init.ps1
运行时,每个命令都会弹出错误窗口
无法打开此密钥(无法打开文件”)
但是,当我清除弹出窗口后检查 Pageant 时,所有密钥都已成功加载到 Pageant 中,我可以使用它们。
我试过了
- 将密钥括在引号中
- 使用
-c
Pageant 上的标志运行命令 - 从命令行运行
- 使用/不使用
-a
Pageant 命令行开关
到目前为止,所有这些都有相同的结果 - 我收到错误弹出窗口,但键已加载。我可以使用其他方法来防止这些错误弹出窗口吗?
答案1
c:\full-path-to-pageant.exe -a c:\full-path-to-key1
Pageant 没有任何-a
开关。它以-a
作为文件名并尝试加载它,但失败了。因此出现错误消息。然后它接受下一个参数并成功加载该键。