【问题标题】:PowerShell ISE: how to run new PowerShell versionPowerShell ISE:如何运行新的 PowerShell 版本
【发布时间】:2019-02-26 10:13:54
【问题描述】:

如何让 PowerShell ISE 与 PowerShell 6.0 一起使用。目前,它有 4.0。

此服务器安装了 PowerShell 4.0,我通过以下链接安装了 PowerShell-6.1.0-win-x64.msi 的 PowerShell 6.0:https://github.com/PowerShell/PowerShell/releases 这些文件现在存在于 C:\Program Files\PowerShell\6 中。

但是,ISE 仍然显示 4.0,但我需要它来运行 6.0

$PSVersionTable.psversion

主要次要版本修订

4 0 -1 -1

【问题讨论】:

  • 您无法让 ISE 运行 PowerShell Core 6.0。

标签: powershell version powershell-ise powershell-core


【解决方案1】:

PowerShell 有 3 个可执行文件...

仅限 Windows...

  • PowerShell_ISE.exe = ISE v2 - v5.1
  • powershell.exe = 控制台主机 v1 - 5.1

注意:(没有新版本推出,但根据 Microsoft 的公告,它将像今天一样受到支持,只是没有新版本。只是错误/安全修复。)

跨平台

  • pwsh.exe = PowerShell 核心/v6

如果您使用的是 v6,则使用的编辑器是 Visual Studio Code,它也是跨平台的,与 ISE 不同。

https://code.visualstudio.com/Download

没有计划让 ISE 利用 pwsh.exe/PSCore。

但是,您可以继续使用 ISE,如果您需要专门的东西来利用 PSCore,您必须像使用 cmd.exe 一样使用它。您的代码将运行 pwsh.exe 控制台,并将您返回到 ISE,具体取决于您如何使用它。

【讨论】:

    【解决方案2】:

    您使用的是 Windows PowerShell ISE,它始终将 Windows PowerShell 作为集成外壳,您需要在这里VSCode,您可以在此处选择要使用的 PowerShell 版本...

    只需在文件 -> 首选项 -> 设置中更改以下项目。

    "terminal.integrated.shell.windows": "C:\\Program Files\\PowerShell\\pwsh.exe"
    

    同样可以通过 UI 完成,只需点击几下...

    【讨论】:

    • 设置terminal.integrated.shell.windows 不影响语言服务器。其设置为powershell.powerShellExePath
    猜你喜欢
    • 2013-10-02
    • 2020-09-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-08-13
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多