First seen in Super Mario World. The switches come in four colors, Yellow, Green, Blue and Red. When activated, they make ! Blocks of the corresponding color whole (and, therefore, usable). They have the same purpose in Super Mario 64.
They are later found in the Paper Mario series. This time, the switches only appear red or blue. Blue switches can only be used once, and normally open passages of some kind. Red switches can be used an unlimited amount of times, and are normally used for moving important object. In Paper Mario: The Thousand-Year Door, there are also "simul-switches" (two must be hit at the same time) and "counted switches" (must be hit a certain number of times).