Commands/enchant

Adds an enchantment to a player's selected item, subject to the same restrictions as an anvil. Also works on any mob or entity holding a weapon/tool/armor in its main hand.
==Syntax==
* Java Edition
: enchant <targets> <enchantment> [<level>]
* Bedrock Edition
: enchant <player: target> <enchantmentId: int> [level: int]
: enchant <player: target> <enchantmentName: Enchant> [level: int]
==Arguments==
: Specifies the target(s).
: 
: 
: or 
: Specifies the enchantment to be added to the item held in main hand by the target.
: 
: Specifies the enchantment level. Should be not greater than the maximum level for the specified enchantmentAlthough /enchant enforces maximum levels and compatibility, other commands (such as , , and ) can bypass these restrictions.. If not specified, defaults to 1.
: , it should be between 1 and 2147483647 (inclusive).
== Result ==
== Output ==
== Examples ==
* To give the Infinity enchantment to all players holding a bow:
*: /enchant @a infinity
* To enchant the nearest player's held sword with Sharpness 5:
*: /enchant @p sharpness 5
== History ==
== References ==
de:Befehl/enchant
es:Comandos/enchant
ja:コマンド/enchant
pt:Comandos/enchant
ru:Команды консоли/enchant
uk:Команди консолі/enchant
zh:命令/enchant