安装没有Microsoft商店的Windows终端

Windows终端是一种新的终端应用程序,旨在使使用命令行工具,cmd.exe和powerShell环境易于使用。 Windows终端支持选项卡,设置自己的配置文件,样式和配置。如果安装了WSL或Azure Cloud Shell,则将自动添加这些环境的外壳。

Windows终端控制台已预安装在Windows 11和Windows 10 22 H2上。在其他版本的Windows上,必须手动安装它。 Microsoft的官方建议是从Microsoft Store安装Windows Terminal,以确保您拥有最新版本,该版本将自动更新(https://www.microsoft.com/en-us/p/windows-terminal/9n0dx20hk701?activetab = pivot:overviewtab)。

如果Microsoft Store应用程序缺失或损坏(例如,在Windows 10 LTSC或Windows Server 2022中),您可以以以下方式安装Windows终端:

  • 通过手动从GitHub下载最新的Windows终端版本并在Windows中安装MSIX文件;
  • 通过使用巧克力或Winget套餐经理。

要进行Windows终端的手动安装,您需要下载MSICIFY该项目官方GitHub的包裹https://github.com/microsoft/terminal/releases。在您的Windows版本中找到最新的终端版本资产部分并下载文件。

另请阅读:2种将Windows终端重置为默认设置的方法

您还可以从Microsoft Store手动下载最新版本的Appx/MsixBundle应用程序。

您可以使用Invoke-webrequest cmdlet下载安装文件:

Invoke-WebRequest -Uri https://github.com/microsoft/terminal/releases/download/v1.18.3181.0/Microsoft.WindowsTerminal_1.18.3181.0_8wekyb3d8bbwe.msixbundle

接下来,使用add-appxpackage cmdlet在Windows中安装软件包:

Add-AppxPackage -Path .Microsoft.WindowsTerminal_1.18.3181.0_8wekyb3d8bbwe.msixbundle

检查软件包是否已成功安装::

Get-AppxPackage *WindowsTerminal* -AllUsers

如果您使用的是最新的PowerShell Core 7.x,请首先导入Appx / MSIX软件包安装模块:

Import-Module Appx -UseWindowsPowerShell

当您在旧的Windows 10构建上手动安装Windows终端时,可能会发生以下错误:

Add-AppPackage : Deployment failed with HRESULT: 0x80073CF3, Package failed updates, dependency or conflict validation.
Windows cannot install package Microsoft.WindowsTerminal_1.18.3181.0_8wekyb3d8bbwe.msixbundle because this package depends on a framework that could not be found. Provide the framework "Microsoft.VCLibs.140.00.UWPDesktop" published by "CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US", with neutral or x64 processor architecture and minimum version 14.0.30035.0, along with this package to install. The frameworks with name Microsoft.VCLibs.140.00.UWPDesktop" currently installed are .....
You must download and install the VCLibs framework before installing the Microsoft.WindowsTerminal package.

下载vclibs包裹 (https://learn.microsoft.com/en-us/troubleshoot/developer/visalstudio/cpp/libraries/c-runtime-packages-desktop-bridge)并使用命令安装它:

Add-AppPackage .Microsoft.VCLibs.x64.14.00.Desktop.appx

在Windows Server 2019或2016上安装Microsoft.windowstern封装时,您可能会遇到另一个错误:

Add-AppxPackage : Deployment failed with HRESULT: 0x80073CFD, A Prerequisite for an install could not be satisfied.

Windows cannot install package Microsoft.WindowsTerminal_1.18.3181.0_8wekyb3d8bbwe because this package is not compatible with the device. The package requires OS version 10.0.19041.0 or higher on the Windows.Mobile device family. The device is currently running OS version 10.0.17763.107.

您可以在这里看到包装在安装过程中检查操作系统。要安装Windows终端,您需要Windows 1903(10.0.18362.0)或更新的Windows构建。结果,您无法在Windows Server 2019上安装Windows终端。在这种情况下,您可以使用独立的经典Windows终端应用程序,由于版本v1.17.11391.0在GitHub上可用。下载Microsoft.WindowsTerminal_1.18.3181.0_x64.zip存档,然后将其提取到本地驱动器上的目录。

如果你得到0x80073CFDWindows 10中的错误,尝试安装更新或使用Microsoft.windowsterminal的早期版本。

您还可以下载Microsoft.windowstermal套件的最新版本,并使用Winget软件包管理器安装它:

winget install --id=Microsoft.WindowsTerminal -e

或巧克力:

Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
choco install microsoft-windows-terminal

可以安装旧版本的软件包:
choco install -y microsoft-windows-terminal --version 1.12.10732.0

这是您在Windows Server 2019上通过Choco安装软件包时看到的错误:

ERROR: This package requires at least Windows 10 version 1903/OS build 18362.x.
The install of microsoft-windows-terminal was NOT successful.
Error while running 'C:ProgramDatachocolateylibmicrosoft-windows-terminaltoolschocolateyInstall.ps1'.

最后,要运行Windows终端,请运行命令:

wt.exe