To give enchanted items through command blocks, you must place the activator and connect it to 2 command blocks. On one of the command blocks, set it back by 1 with a redstone repeater and type in the set-back one "Enchant @p [Enchantment ID] [Level]". Then, in the one without the repeater, type /give @p [Item that is going to be enchanted] [Amount]. Then, you're done!
A video tutorial - (Please support my channel by subscribing )
I hope this helps!