VS Code 上的 [pwsh] 和 [Powershell 集成控制台] 有什么区别? [英] What is the difference between [pwsh] and [Powershell Integrated Console] on VS Code?

查看:78
本文介绍了VS Code 上的 [pwsh] 和 [Powershell 集成控制台] 有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

VS Code 上的 [pwsh] 和 [Powershell 集成控制台] 有什么区别?
我通常使用 pwsh.
今天,当我安装powershell扩展然后尝试更新powershell时,Powershell集成控制台启动并发现.这是什么?

解决方案

  • pwsh[.exe]PowerShell [Core] (v6+) 的可执行文件名,跨平台基于 .NET Core 的 PowerShell 版本;相比之下,powershell.exe 是旧版 Windows PowerShell 版本 (v5.1-) 的可执行文件名称,构建于仅限 Windows 的 .NET 框架之上.

    • Windows PowerShell 随 Windows 一起提供,PowerShell [Core] 必须根据需要
  • 相比之下,PowerShell 集成控制台是一个特殊外壳带有

  • 在 Windows 上,您可以


[+] 从 v7.0 开始;时间会证明 PowerShell [Core] 是否会与未来版本的 Windows 甚至其他平台一起提供.

[*] 来自 链接文档:此功能查看不同操作系统上的一些众所周知的路径,以发现 PowerShell 的安装位置.如果您将 PowerShell 安装到非典型位置,它最初可能不会显示在会话菜单中.您可以通过 添加您自己的自定义路径."如果您使用 官方安装程序 之一,PowerShell 扩展应该会找到您的安装.上>

What is the difference between [pwsh] and [Powershell Integreted Console] on VS Code?
I usualy use pwsh.
Today, when I installed the powershell extension and then tried to update the powershell, the Powershell Integreted Console started up and found out. What is this?  

解决方案

  • pwsh[.exe] is the executable file name of PowerShell [Core] (v6+), the cross-platform edition of PowerShell built on .NET Core; by contrast, powershell.exe is the executable name of the legacy Windows PowerShell edition (v5.1-), built on the Windows-only .NET Framework.

    • Windows PowerShell comes with Windows, PowerShell [Core] must be installed on demand (on all supported platforms).[+]
  • VSCode (Visual Studio Code) has an integrated terminal (console) that can run any shell, such as cmd.exe, bash, or pwsh or powershell.

    • Shells that run in the integrated terminal by default have no special integration with the files being edited. They show by their executable file name in the dropdown list in the integrated terminal's toolbar; e.g.:
  • By contrast, the PowerShell Integrated Console is a special shell that comes with the PowerShell extension and offers integration with PowerShell code being edited, notably to provide linting and debugging support, among other features.

    • The PowerShell Integrated Console starts on demand when you first open/activate an editor with PowerShell code in a session, and it shows as follows in the integrated terminal's toolbar:

    • On Windows, you can use the PowerShell extension's configuration to choose between running PowerShell [Core] (pwsh.exe) and Windows PowerShell (powershell.exe) in the PowerShell Integrated Console.

      • If a PowerShell [Core] version is installed and it is installed in a well-known location[*], it will be used by default; the fallback on Windows is Windows PowerShell. Since PowerShell [Core] versions can be installed side by side, you can switch between different versions, if installed.

      • If a PowerShell [Core] version in installed in a nonstandard location and is therefore not discovered automatically, you can tell the PowerShell extension where to find it via settings.json, as shown in the linked topic and the bottom section of this answer.

      • The status bar in the bottom-right corner shows the PowerShell version that is being used (versions >= 6 imply PowerShell [Core]; you can click on the version number to switch to a different version); e.g.:


[+] as of v7.0; time will tell if PowerShell [Core] will ship with future versions of Windows, and perhaps even other platforms.

[*] From the linked docs: "This feature looks at a few well-known paths on different operating systems to discover install locations of PowerShell. If you installed PowerShell to a non-typical location, it might not show up initially in the Session Menu. You can extend the session menu by adding your own custom paths." If you use one of the official installers, the PowerShell extension should find your installation.

这篇关于VS Code 上的 [pwsh] 和 [Powershell 集成控制台] 有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆