> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Store 开发权利工具 (DevEntitlementTool.exe)

> 命令行工具 DevEntitlementTool.exe，用于在开发沙盒中查询、添加以及删除 XBOX 测试帐户的 Microsoft Store 权益。

命令行工具,用于查询、向沙盒中的 XBOX 测试帐户添加以及从中删除 Microsoft Store 权利。

## 用法

`deventitlementtool <command> /e <testaccountemail> /s <sandboxid> [/p <productid>] [...]`

| 命令                  | 说明               |
| ------------------- | ---------------- |
| [query](#query)     | 查找帐户拥有的权利        |
| [add](#add)         | 向帐户添加一个或多个指定的权利  |
| [delete](#delete)   | 从帐户中删除一个或多个指定的权利 |
| [catalog](#catalog) | 显示指定父产品可销售的可用产品  |

所有命令都需要 /e(电子邮件)和 /s(沙盒)参数。
使用某个帐户首次登录会调用交互式密码输入对话框。
成功登录后,后续对设备上相同帐户/沙盒的操作不再需要输入密码。

## query

`deventitlementtool query /e <testaccountemail> /s <sandboxid> [/d]`

列出在沙盒中与此帐户关联的所有直接拥有的权利。

### query 输出

```text theme={null}
Entitlements found: {Number of entitlements}
{ProductID}: {Last Updated Date (UTC)} {Status}
...
```

### query 示例

```text theme={null}
> DevEntitlementTool.exe query /e xdks-testaccount00000@xboxtest.com /s XDKS.1
Entitlements found: 2
9MT5TGW893HV: 4/18/2023 5:05:19 PM  Active
9N30KZZF4BR9: 7/24/2024 2:34:08 AM  Active
```

使用 /d 显示每个权利的更多详细信息:

```text theme={null}
> DevEntitlementTool.exe query /e xdks-testaccount00000@xboxtest.com /s XDKS.1 /d
Entitlements found: 2
9MT5TGW893HV: 4/18/2023 5:05:19 PM  Active Consumable   ATG Sample Consumable 3
9N30KZZF4BR9: 7/24/2024 2:34:08 AM  Active Durable      ATG Sample Durable 1
```

## add

`deventitlementtool add /e <testaccountemail> /s <sandboxid> /p <productid1> [<productid2> <productid3> ...] [/q <quantity>] [/d]`

向帐户添加一个或多个指定产品的权利。
此命令等同于从 Store 或通过购买 API 购买该产品。

对已授予权利的游戏、Durable、Bundle 或开发者管理的消耗品执行 `add` 操作时,不会添加另一个权利,工具会报告现有权利。

对于 Store 管理的消耗品产品,每次执行 add 命令时,默认将 `1` 的数量添加到消耗品余额中。
可以指定可选的数量值来更改此默认值,但仅当使用 /p 传递单个 productID 时才能使用数量字段。
此选项对于购买时授予大于 `1` 的数量的消耗品很有用。

支持使用 /d 获取更多详细信息。

<Note>此工具无法验证数量。</Note>
若要确定项目的当前数量,请查看 [XStoreCollectionData](/reference/system/xstore/structs/xstorecollectiondata) 结构。

对捆绑产品执行 `add` 操作会授予其包含的所有产品。
如果指定了数量且捆绑包中包含 Store 管理的消耗品,则会向每个消耗品分配相同的数量。

<Note>不支持订阅产品。</Note>

### add 输出

```console theme={null}
Entitlements added: {Number of entitlements}
{ProductID}: {Last Updated Date (UTC)} {Status}
...
```

### add 示例

添加单个权利

```console theme={null}
> DevEntitlementTool.exe add /e xdks-test00000@xboxtest.com /s XDKS.1 /p 9MT5TGW893HV
Entitlements added: 1
9MT5TGW893HV: 2/20/2024 12:21:25 AM Active
```

添加多个权利

```console theme={null}
> DevEntitlementTool.exe add /e xdks-test00000@xboxtest.com /s XDKS.1 /p 9P23V43P0XZZ 9N30KZZF4BR9 9NCX1H100M18
Entitlements added: 4
9P23V43P0XZZ: 2/20/2024 12:33:20 AM Active
9N30KZZF4BR9: 2/20/2024 12:33:20 AM Active
9NCX1H100M18: 2/20/2024 12:33:20 AM Active
```

添加带有数量的消耗品

```console theme={null}
> DevEntitlementTool.exe add /e xdks-test00000@xboxtest.com /s XDKS.1 /p 9MT5TGW893HV /q 4321
Entitlements added: 1
9MT5TGW893HV: 2/20/2024 12:34:35 AM Active
```

## delete

`deventitlementtool delete /e <testaccountemail> /s <sandboxid> /p <productid1> [<productid2> <productid3> ...] [/all] [/d]`

从帐户中删除一个或多个指定的权利。

如果指定了 `/all`,它会尝试删除与帐户和沙盒关联的所有权利。

对于通过此工具授予的删除权利,会显示 Revoked(已吊销)状态。

对于通过 Store 客户端或游戏内 API 常规购买的删除权利,会显示 Refunded(已退款)状态。

支持使用 /d 获取更多详细信息。

### delete 输出

```console theme={null}
Entitlements deleted: {Number of entitlements}
{ProductID}: {Last Updated Date (UTC)} {Status}
...
```

### delete 示例

```console theme={null}
> DevEntitlementTool.exe delete /e xdks-test00000@xboxtest.com /s XDKS.1 /p 9P23V43P0XZZ 9N30KZZF4BR9 9NCX1H100M18
Entitlements deleted: 3
9P23V43P0XZZ: 2/20/2024 2:26:13 AM Revoked
9N30KZZF4BR9: 2/20/2024 2:26:13 AM Revoked
9NCX1H100M18: 2/20/2024 2:26:13 AM Revoked
```

```console theme={null}
> DevEntitlementTool.exe delete /e xdks-test00000@xboxtest.com /s XDKS.1 /p 9PLRFWZWWF91
Entitlements deleted: 1
9PLRFWZWWF91: 1/1/0001 12:00:00 AM Refunded
```

## catalog

`deventitlementtool catalog /e <testaccountemail> /s <sandboxid> /p <productid1> [/m]`

显示由提供的产品 ID 可销售的产品集;即子插件产品以及在合作伙伴中心中与 productID 具有 *can use and sell* 关系的产品。
此命令等效于 [XStoreQueryAssociatedProductsAsync](/reference/system/xstore/functions/xstorequeryassociatedproductsasync) 返回的内容。
在合作伙伴中心中配置为 *available but not discoverable in the Microsoft Store*(可用但在 Microsoft Store 中不可发现)的产品不会返回。
可选地,可以指定市场以检索该特定市场的价格。
该参数需要是 ISO 双字符区域代码,例如 GB、CA、JP、ES 等。

### catalog 输出

```console theme={null}
Parent product: {ProductID} ({Parent Product Name})
can sell {Number of products} products:
1. {ProductID} {Product Name} {Product Type} {Price}
2. {ProductID} {Product Name} {Product Type} {Price}
...
```

### catalog 示例

```console theme={null}
> DevEntitlementTool.exe catalog /e xdks-test00000@xboxtest.com /s XDKS.1 /p 9NTL0QDWZ4FS /m SG
Parent product: 9NTL0QDWZ4FS (ATG In-Game Store)
can sell 16 products:
 1. 9PHPTTDP88F7: ATG Season Pass 1                        Durable      23.25 SGD
 2. 9NMDDZC7ZWRM: ATG Sample Year 1 Pass                   Durable      2850 SGD
 3. 9PGLXLWS7319: ATG Consumable Only Bundle               Durable      7.2 SGD
 4. 9P23V43P0XZZ: ATG Sample Durable 2                     Durable      0 SGD
 5. 9MZ0MGGFPLTP: ATG Sample Subscription 1                Durable      0 SGD
 6. 9MT5TGW893HV: ATG Sample Consumable 3                  Consumable   4.35 SGD
 7. 9N30KZZF4BR9: ATG Sample Durable 1                     Durable      0 SGD
 8. 9PLRFWZWWF91: ATG Sample Durable 4                     Durable      0 SGD
 9. 9PLNMXRKNM4C: ATG Sample Durable 1 (with package)      Durable      0 SGD
10. 9P8S15PJTB0P: ATG Sample Durable 3                     Durable      48.75 SGD
11. 9NCX1H100M18: ATG Sample Consumable 2                  Consumable   2.85 SGD
12. 9N0297GK108W: ATG Dev managed consumable 1             Consumable   2.1 SGD
13. 9NQWJKKNHF1L: ATG Downloadable Content Sample          Game         0 SGD
14. 9NRGW2QG5PCW: ATG Sample Pre-Order 1                   Durable      0 SGD
15. 9PHHWZ12RR23: ATG In-Game Store Deluxe Add-on          Durable      0 SGD
16. 9PFL4RQTB1P6: ATG Sample Consumable 1                  Consumable   1.5 SGD
```

## 备注

此工具严格用于 XBOX 测试帐户和沙盒产品。
禁止用于零售帐户和场景。

每个帐户每天的 add 和 delete 操作有数量限制。
此限制会根据观察到的使用情况进行调整。
若要请求增加限制或提供其他反馈,请通过你的 Microsoft 客户经理与我们联系。

## 参考 API 文档

* [XStore(API 内容)](/reference/system/xstore/xstore_members)
  * 函数
    * [XStoreQueryAssociatedProductsAsync](/reference/system/xstore/functions/xstorequeryassociatedproductsasync)
  * 结构
    * [XStoreCollectionData](/reference/system/xstore/structs/xstorecollectiondata)


## Related topics

- [XBOX 服务开发工具](/zh-CN/tools/tools-services/live-tools.md)
- [XBOX 服务工具](/zh-CN/tools/tools-services/live-tools-nav.md)
- [XStoreCollectionData](/zh-CN/reference/system/xstore/structs/xstorecollectiondata.md)
- [面向 XBOX 与 PlayFab 的在线服务工具](/zh-CN/tools/tools-services/index.md)
- [XBOX 服务开发者帐户工具 (XblDevAccount.exe)](/zh-CN/tools/tools-services/live-dev-account-tool.md)
