-File 参数的参数“install-sshed.ps1”不存在 | 电源外壳

Dee*_*lia 3 ssh powershell windows-7-x64

我正在使用 powershell 添加密钥到 windows 7 x64

到目前为止,我已经使用 powershell 尝试了以下命令

powershell -executionpolicy bypass -file install-sshed.ps1
Run Code Online (Sandbox Code Playgroud)

我收到这样的错误:

-File 参数的参数“install-sshed.ps1”不存在。提供现有“.ps1”文件的路径作为 -File 参数的参数

我做错了什么?

小智 5

您的 PowerShell 会话似乎是在与 PowerShell 脚本不同的文件夹中启动的。尝试添加 PowerShell 脚本的完整路径:

powershell -executionpolicy bypass -file "c:\scripts\install-sshed.ps1"
Run Code Online (Sandbox Code Playgroud)

或者,首先更改到文件所在的目录*.ps1

cd c:\scripts
powershell -executionpolicy bypass -file install-sshed.ps1
Run Code Online (Sandbox Code Playgroud)