First, you need to find a villager and build a fence around him so that the villager can't run away. In Minecraft, villagers can be found in the Plains biome or Desert biome in villages.
In this example, we've placed the villager inside of a nether brick fence so that the fence doesn't burn when the lightning strikes. Other fence types (ie: wooden fences) are flamable and may burn away from fire caused by the lightning.
Here are some of the materials you can use to build a fence:
TIP: When you summon the lightning bolt, it will strike close to you and cause you damage in Survival mode. If you don't want to get hurt, switch to Creative mode and then summon the lightning bolt.
To enter a command in Minecraft, press the T key to open the chat window. Then type the command in the chat window. As you are typing, you will see the command appear in the lower left corner of the game window. Press the Enter key to run the command.
3. Villager will Transform into Witch
Once the cheat has been entered, you will hear the sound of thunder and see a flash of light. The lightning bolt will strike near the villager and turn the villager into a witch.
You will see the message "Object successfully summoned" appear in the lower left corner of the game window to indicate that the lightning bolt has been summoned.
WARNING: When the lightning bolt strikes, it may start a fire. Keep your valuables safe so that they don't catch on fire!
Congratulations, you just learned how to use lightning to turn a villager into a witch in Minecraft.