The Motion Boutique posts a free little script for After Effects that will create a gear shape easily.

Gears are great shapes that can be used in various situations, but they are even better when you can animate them

Built off an Illustrator script for creating gears from Jongware and ported to work in After Effects, the Create Gear Script allows you to change the size of the gear, the number of teeth, and the tooth depth and taper attributes.

The Create Gear script for After Effects really shines however, when animated, perhaps with Newton for After Effects.

Check out the Create Gears Script for After Effects over at the MotionBoutique here.