我该如何做才能双击ps1文件打开powershell?

时间:2020-06-23 21:27:47

标签: windows powershell

我希望能够双击Powershell脚本,然后在Powershell中打开它而不是在记事本中打开它。我可以这样做吗?

要从文件中运行Powershell脚本,请右键单击该脚本,然后单击“使用powershell运行”,是否可以使它双击脚本默认在Powershell中打开该脚本?

1 个答案:

答案 0 :(得分:0)

使用

ftype Microsoft.PowerShellScript.1="C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" "%1"

在管理员cmd中。 Ftype更改由assoc cmd命令指定的某些文件类型的双击行为。