Bats only appear to be enemies that reside in caves or random areas, although it is a possibility that bats are with the pirates, as they are found in Pirate Cove.
Bats don't really attack you, although if you get too close to them, they attack you. They can be taken out in one hit by any attack. Bats are mainly used as a way to get to higher points and to get to extra Squiggles or Stars. They are also used in micro-trials, although they mainly play as obstacles.