配置 Windows 10 任务栏Configure Windows 10 taskbar

从 Windows 10 版本 1607 开始,管理员可将其他应用固定到任务栏和从任务栏删除默认固定的应用,方法是将 <TaskbarLayout> 部分添加到布局修改 XML 文件。Starting in Windows 10, version 1607, administrators can pin additional apps to the taskbar and remove default pinned apps from the taskbar by adding a <TaskbarLayout> section to a layout modification XML file. 此方法不会从任务栏删除用户固定的应用。This method never removes user-pinned apps from the taskbar.

备注

任务栏当前可由布局修改 XML 文件配置的唯一一个方面是布局。The only aspect of the taskbar that can currently be configured by the layout modification XML file is the layout.

可以根据设备区域设置或地区指定不同的任务栏配置。You can specify different taskbar configurations based on device locale and region. 可固定的应用数没有限制。There is no limit on the number of apps that you can pin. 使用应用程序用户模型 ID (AUMID) 或桌面应用程序链接路径(指向应用程序的本地路径)指定应用。You specify apps using the Application User Model ID (AUMID) or Desktop Application Link Path (the local path to the application).

如果将未针对计算机上的用户进行预配的应用指定为要固定的应用,则固定的图标不会显示在任务栏上。If you specify an app to be pinned that is not provisioned for the user on the computer, the pinned icon won't appear on the taskbar.

XML 文件中应用的顺序决定了任务栏上固定应用的顺序(从左到右),这些应用位于用户固定的任何现有应用的右侧。The order of apps in the XML file dictates the order of pinned apps on the taskbar from left to right, to the right of any existing apps pinned by the user.

备注

在配置为使用从右往左语言的操作系统中,任务栏的顺序将反转。In operating systems configured to use a right-to-left language, the taskbar order will be reversed.

以下示例显示应用固定方式:Windows 默认应用在左侧(蓝色圆圈)、用户固定的应用在中心(橙色三角形),使用 XML 文件固定的应用在右侧(绿色方块)。The following example shows how apps will be pinned: Windows default apps to the left (blue circle), apps pinned by the user in the center (orange triangle), and apps that you pin using the XML file to the right (green square).

Windows 默认应用居左,用户固定应用居中,企业固定应用居右

配置任务栏(常规)Configure taskbar (general)

若要配置任务栏:To configure the taskbar:

  1. 创建 XML 文件。Create the XML file.
  2. 编辑并保存该 XML 文件。Edit and save the XML file. 可使用 AUMID 或桌面应用程序链接路径标识要固定到任务栏的应用。You can use AUMID or Desktop Application Link Path to identify the apps to pin to the taskbar.
    • 添加到 xmlns:taskbar="http://schemas.microsoft.com/Start/2014/TaskbarLayout" 文件的第一行,在 >。Add xmlns:taskbar="http://schemas.microsoft.com/Start/2014/TaskbarLayout" to the first line of the file, before the closing >.
    • 使用 <taskbar:UWA>AUMID 固定通用 Windows 平台应用。Use <taskbar:UWA> and AUMID to pin Universal Windows Platform apps.
    • 使用 <taskbar:DesktopApp> 和桌面应用程序链接路径固定桌面应用程序。Use <taskbar:DesktopApp> and Desktop Application Link Path to pin desktop applications.
  3. 使用组策略在 Windows 映像和配置设计器 (Windows ICD) 中创建的预配包,将布局修改 XML 文件应用到设备。Apply the layout modification XML file to devices using Group Policy or a provisioning package created in Windows Imaging and Configuration Designer (Windows ICD).

重要

如果使用预配包或 import-startlayout 配置任务栏,则在每次重启 explorer.exe 进程时都会重新应用该配置。If you use a provisioning package or import-startlayout to configure the taskbar, your configuration will be reapplied each time the explorer.exe process restarts. 如果配置固定了某个应用,而用户取消固定该应用,则用户更改将在下次应用配置时覆盖。If your configuration pins an app and the user then unpins that app, the user's change will be overwritten the next time the configuration is applied. 若要应用任务栏配置以允许用户做出可以保留的更改,请使用组策略以应用你的配置。To apply a taskbar configuration that allows users to make changes that will persist, apply your configuration by using Group Policy.

如果使用组策略并且配置仅包含任务栏布局,则会应用默认 Windows 磁贴布局,并且用户无法更改。If you use Group Policy and your configuration only contains a taskbar layout, the default Windows tile layout will be applied and cannot be changed by users. 如果使用组策略并且配置包括任务栏和完整“开始”菜单布局,则用户仅可以更改任务栏。If you use Group Policy and your configuration includes taskbar and a full Start layout, users can only make changes to the taskbar. 如果使用组策略并且配置包含任务栏和部分“开始”菜单布局,则用户可以更改任务栏和部分“开始”菜单布局中未定义的磁贴组。If you use Group Policy and your configuration includes taskbar and a partial Start layout, users can make changes to the taskbar and to tile groups not defined in the partial Start layout.

在布局修改 XML 文件中,需要在 XML 标记中添加应用程序条目。In the layout modification XML file, you will need to add entries for applications in the XML markup. 为了固定应用程序,需要其 AUMID 或桌面应用程序链接路径。In order to pin an application, you need either its AUMID or Desktop Application Link Path.

查找应用程序的此数据的最简方法是:The easiest way to find this data for an application is to:

  1. 将应用程序固定到参考电脑或测试电脑的“开始”菜单中。Pin the application to the Start menu on a reference or testing PC.
  2. 打开 Windows PowerShell,然后运行 Export-StartLayout cmdlet。Open Windows PowerShell and run the Export-StartLayout cmdlet.
  3. 打开生成的 XML 文件。Open the generated XML file.
  4. 查找与固定的应用相对应的条目。Look for an entry corresponding to the app you pinned.
  5. 查找标记为 AppUserModelIDDesktopApplicationLinkPath 的属性。Look for a property labeled AppUserModelID or DesktopApplicationLinkPath.

任务栏配置 XML 文件示例Sample taskbar configuration XML file

<?xml version="1.0" encoding="utf-8"?>
<LayoutModificationTemplate
    xmlns="http://schemas.microsoft.com/Start/2014/LayoutModification"
    xmlns:defaultlayout="http://schemas.microsoft.com/Start/2014/FullDefaultLayout"
    xmlns:start="http://schemas.microsoft.com/Start/2014/StartLayout"
    xmlns:taskbar="http://schemas.microsoft.com/Start/2014/TaskbarLayout"
    Version="1">
  <CustomTaskbarLayoutCollection>
    <defaultlayout:TaskbarLayout>
      <taskbar:TaskbarPinList>
        <taskbar:UWA AppUserModelID="Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge" />
        <taskbar:DesktopApp DesktopApplicationLinkPath="%APPDATA%\Microsoft\Windows\Start Menu\Programs\System Tools\File Explorer.lnk" />
      </taskbar:TaskbarPinList>
    </defaultlayout:TaskbarLayout>
 </CustomTaskbarLayoutCollection>
</LayoutModificationTemplate>

添加到“开始”菜单布局 XML 文件的任务栏配置示例Sample taskbar configuration added to Start layout XML file

<?xml version="1.0" encoding="utf-8"?>
<LayoutModificationTemplate
    xmlns="http://schemas.microsoft.com/Start/2014/LayoutModification"
    xmlns:defaultlayout="http://schemas.microsoft.com/Start/2014/FullDefaultLayout"
    xmlns:start="http://schemas.microsoft.com/Start/2014/StartLayout"
    xmlns:taskbar="http://schemas.microsoft.com/Start/2014/TaskbarLayout"
    Version="1">
  <LayoutOptions StartTileGroupCellWidth="6" StartTileGroupsColumnCount="1" />
  <DefaultLayoutOverride>
    <StartLayoutCollection>
      <defaultlayout:StartLayout GroupCellWidth="6" xmlns:defaultlayout="http://schemas.microsoft.com/Start/2014/FullDefaultLayout">
        <start:Group Name="Life at a glance" xmlns:start="http://schemas.microsoft.com/Start/2014/StartLayout">
          <start:Tile Size="2x2" Column="0" Row="0" AppUserModelID="Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge" />
          <start:Tile Size="2x2" Column="4" Row="0" AppUserModelID="Microsoft.Windows.Cortana_cw5n1h2txyewy!CortanaUI" />
          <start:Tile Size="2x2" Column="2" Row="0" AppUserModelID="Microsoft.BingWeather_8wekyb3d8bbwe!App" />
        </start:Group>        
      </defaultlayout:StartLayout>
    </StartLayoutCollection>
  </DefaultLayoutOverride>
    <CustomTaskbarLayoutCollection>
      <defaultlayout:TaskbarLayout>
        <taskbar:TaskbarPinList>
          <taskbar:UWA AppUserModelID="Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge" />
          <taskbar:DesktopApp DesktopApplicationLinkPath="%APPDATA%\Microsoft\Windows\Start Menu\Programs\System Tools\File Explorer.lnk" />
        </taskbar:TaskbarPinList>
      </defaultlayout:TaskbarLayout>
    </CustomTaskbarLayoutCollection>
</LayoutModificationTemplate>

保留默认应用,并添加你自己的应用Keep default apps and add your own

默认情况下,<CustomTaskbarLayoutCollection> 部分将列出的应用附加到任务栏。The <CustomTaskbarLayoutCollection> section will append listed apps to the taskbar by default. 以下示例保留了默认应用的固定状态,并添加了 Paint、Microsoft Reader 和某个命令提示符的引脚。The following sample keeps the default apps pinned and adds pins for Paint, Microsoft Reader, and a command prompt.

<?xml version="1.0" encoding="utf-8"?>
<LayoutModificationTemplate
    xmlns="http://schemas.microsoft.com/Start/2014/LayoutModification"
    xmlns:defaultlayout="http://schemas.microsoft.com/Start/2014/FullDefaultLayout"
    xmlns:start="http://schemas.microsoft.com/Start/2014/StartLayout"
    xmlns:taskbar="http://schemas.microsoft.com/Start/2014/TaskbarLayout"
    Version="1">
  <CustomTaskbarLayoutCollection>
    <defaultlayout:TaskbarLayout>
      <taskbar:TaskbarPinList>
        <taskbar:DesktopApp DesktopApplicationLinkPath="%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs\Accessories\Paint.lnk" />
        <taskbar:UWA AppUserModelID="Microsoft.Reader_8wekyb3d8bbwe!Microsoft.Reader" />
        <taskbar:DesktopApp DesktopApplicationLinkPath="%appdata%\Microsoft\Windows\Start Menu\Programs\System Tools\Command Prompt.lnk" />
      </taskbar:TaskbarPinList>
    </defaultlayout:TaskbarLayout>
  </CustomTaskbarLayoutCollection>
</LayoutModificationTemplate>

之前:Before:

固定到任务栏的默认应用

之后:After:

固定到任务栏的其他应用

删除默认应用,并添加你自己的应用Remove default apps and add your own

通过将 PinListPlacement="Replace" 添加到 <CustomTaskbarLayoutCollection>,可删除所有默认的固定应用;仅指定的应用将固定到任务栏。By adding PinListPlacement="Replace" to <CustomTaskbarLayoutCollection>, you remove all default pinned apps; only the apps that you specify will be pinned to the taskbar.

如果仅希望删除某些默认的固定应用,可使用此方法删除所有默认的固定应用,然后将希望保留在固定应用列表中的默认应用包含在内。If you only want to remove some of the default pinned apps, you would use this method to remove all default pinned apps and then include the default app that you want to keep in your list of pinned apps.

<?xml version="1.0" encoding="utf-8"?>
<LayoutModificationTemplate
    xmlns="http://schemas.microsoft.com/Start/2014/LayoutModification"
    xmlns:defaultlayout="http://schemas.microsoft.com/Start/2014/FullDefaultLayout"
    xmlns:start="http://schemas.microsoft.com/Start/2014/StartLayout"
    xmlns:taskbar="http://schemas.microsoft.com/Start/2014/TaskbarLayout"
    Version="1">
  <CustomTaskbarLayoutCollection PinListPlacement="Replace">
    <defaultlayout:TaskbarLayout>
      <taskbar:TaskbarPinList>
        <taskbar:DesktopApp DesktopApplicationLinkPath="%APPDATA%\Microsoft\Windows\Start Menu\Programs\Accessories\Internet Explorer.lnk"/>
        <taskbar:DesktopApp DesktopApplicationLinkPath="%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs\Accessories\Paint.lnk" />
        <taskbar:UWA AppUserModelID="Microsoft.Office.Word_8wekyb3d8bbwe!microsoft.word" />
      </taskbar:TaskbarPinList>
    </defaultlayout:TaskbarLayout>
  </CustomTaskbarLayoutCollection>
</LayoutModificationTemplate>

之前:Before:

具有默认应用的任务栏

之后:After:

删除了默认应用的任务栏

删除默认应用Remove default apps

通过将 PinListPlacement="Replace" 添加到 <CustomTaskbarLayoutCollection> 来删除所有默认的固定应用。By adding PinListPlacement="Replace" to <CustomTaskbarLayoutCollection>, you remove all default pinned apps.

<?xml version="1.0" encoding="utf-8"?>
<LayoutModificationTemplate
    xmlns="http://schemas.microsoft.com/Start/2014/LayoutModification"
    xmlns:defaultlayout="http://schemas.microsoft.com/Start/2014/FullDefaultLayout"
    xmlns:start="http://schemas.microsoft.com/Start/2014/StartLayout"
    xmlns:taskbar="http://schemas.microsoft.com/Start/2014/TaskbarLayout"
    Version="1">
  <CustomTaskbarLayoutCollection PinListPlacement="Replace">
    <defaultlayout:TaskbarLayout>
      <taskbar:TaskbarPinList>
        <taskbar:DesktopApp DesktopApplicationLinkPath="#leaveempty"/>
      </taskbar:TaskbarPinList>
    </defaultlayout:TaskbarLayout>
  </CustomTaskbarLayoutCollection>
</LayoutModificationTemplate>

按国家或地区配置任务栏Configure taskbar by country or region

以下示例显示如何按国家或地区配置任务栏。The following example shows you how to configure taskbars by country or region. 当布局应用到计算机时,如果当前地区没有带有地区标记的 <TaskbarPinList> 节点,则将应用第一个没有指定地区的 <TaskbarPinList> 节点。When the layout is applied to a computer, if there is no <TaskbarPinList> node with a region tag for the current region, the first <TaskbarPinList> node that has no specified region will be applied. 当在 <TaskbarPinList> 节点中指定一个或多个国家或地区时,指定的应用将固定到为任何指定的国家或地区配置的计算机。When you specify one or more countries or regions in a <TaskbarPinList> node, the specified apps are pinned on computers configured for any of the specified countries or regions.

<?xml version="1.0" encoding="utf-8"?>
<LayoutModificationTemplate
    xmlns="http://schemas.microsoft.com/Start/2014/LayoutModification"
    xmlns:defaultlayout="http://schemas.microsoft.com/Start/2014/FullDefaultLayout"
    xmlns:start="http://schemas.microsoft.com/Start/2014/StartLayout"
    xmlns:taskbar="http://schemas.microsoft.com/Start/2014/TaskbarLayout"
    Version="1">

  <CustomTaskbarLayoutCollection PinListPlacement="Replace">
    <defaultlayout:TaskbarLayout region="US|UK">
      <taskbar:TaskbarPinList >
        <taskbar:UWA AppUserModelID="Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge" />
        <taskbar:DesktopApp DesktopApplicationLinkPath="%APPDATA%\Microsoft\Windows\Start Menu\Programs\System Tools\File Explorer.lnk" />
        <taskbar:UWA AppUserModelID="Microsoft.Office.Word_8wekyb3d8bbwe!microsoft.word" />
        <taskbar:DesktopApp DesktopApplicationLinkPath="%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs\Accessories\Paint.lnk"/>
        <taskbar:UWA AppUserModelID="Microsoft.Reader_8wekyb3d8bbwe!Microsoft.Reader" />
      </taskbar:TaskbarPinList>
    </defaultlayout:TaskbarLayout>
    <defaultlayout:TaskbarLayout region="DE|FR">
      <taskbar:TaskbarPinList>
        <taskbar:DesktopApp DesktopApplicationLinkPath="%APPDATA%\Microsoft\Windows\Start Menu\Programs\System Tools\File Explorer.lnk" />
        <taskbar:UWA AppUserModelID="Microsoft.Office.Word_8wekyb3d8bbwe!microsoft.word" />
        <taskbar:UWA AppUserModelID="Microsoft.Office.Excel_8wekyb3d8bbwe!microsoft.excel" />
        <taskbar:DesktopApp DesktopApplicationLinkPath="%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs\Accessories\Paint.lnk"/>
        <taskbar:UWA AppUserModelID="Microsoft.Reader_8wekyb3d8bbwe!Microsoft.Reader" />
      </taskbar:TaskbarPinList>
    </defaultlayout:TaskbarLayout>
    <defaultlayout:TaskbarLayout>
      <taskbar:TaskbarPinList>
        <taskbar:DesktopApp DesktopApplicationLinkPath="%APPDATA%\Microsoft\Windows\Start Menu\Programs\System Tools\File Explorer.lnk" />
        <taskbar:UWA AppUserModelID="Microsoft.Office.Word_8wekyb3d8bbwe!microsoft.word" />
        <taskbar:DesktopApp DesktopApplicationLinkPath="%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs\Accessories\Paint.lnk"/>
        <taskbar:UWA AppUserModelID="Microsoft.Reader_8wekyb3d8bbwe!Microsoft.Reader" />
      </taskbar:TaskbarPinList>
    </defaultlayout:TaskbarLayout>
  </CustomTaskbarLayoutCollection>
</LayoutModificationTemplate>

应用了前述的示例 XML 文件后,在美国或英国生成的计算机任务栏为:When the preceding example XML file is applied, the resulting taskbar for computers in the US or UK:

美国和英国区域设置的任务栏

在德国或法国生成的计算机任务栏:The resulting taskbar for computers in Germany or France:

德国和法国区域设置的任务栏

在其他任何国家/地区生成的计算机任务栏:The resulting taskbar for computers in any other country region:

其他所有地区的任务栏

布局修改模板架构定义Layout Modification Template schema definition

<?xml version="1.0" encoding="utf-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns:local="http://schemas.microsoft.com/Start/2014/TaskbarLayout"
            targetNamespace="http://schemas.microsoft.com/Start/2014/TaskbarLayout"
            elementFormDefault="qualified">

  <xsd:complexType name="ct_PinnedUWA">
    <xsd:attribute name="AppUserModelID" type="xsd:string" />
  </xsd:complexType>

  <xsd:complexType name="ct_PinnedDesktopApp">
    <xsd:attribute name="DesktopApplicationID" type="xsd:string" />
    <xsd:attribute name="DesktopApplicationLinkPath" type="xsd:string" />
  </xsd:complexType>

  <xsd:complexType name="ct_TaskbarPinList">
    <xsd:sequence>
      <xsd:choice minOccurs="1" maxOccurs="unbounded">
        <xsd:element name="UWA" type="local:ct_PinnedUWA" />
        <xsd:element name="DesktopApp" type="local:ct_PinnedDesktopApp" />
      </xsd:choice>
    </xsd:sequence>
    <xsd:attribute name="Region" type="xsd:string" use="optional" />
  </xsd:complexType>

  <xsd:simpleType name="st_TaskbarPinListPlacement">
    <xsd:restriction base="xsd:string">
      <xsd:enumeration value="Append" />
      <xsd:enumeration value="Replace" />
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:attributeGroup name="ag_SelectionAttributes">
    <xsd:attribute name="SKU" type="xsd:string" use="optional"/>
    <xsd:attribute name="Region" type="xsd:string" use="optional"/>
  </xsd:attributeGroup>

  <xsd:complexType name="ct_TaskbarLayout">
    <xsd:sequence>
      <xsd:element name="TaskbarPinList" type="local:ct_TaskbarPinList" minOccurs="1" maxOccurs="1" />
    </xsd:sequence>
    <xsd:attributeGroup ref="local:ag_SelectionAttributes"/>
  </xsd:complexType>

</xsd:schema>