In general, microelectromechanical systems (MEMS) are excited using a nonlinear electrostatic field. Due to the nonlinearity, the frequency of the device response to a step input depends on the input magnitude. As a result, traditional shaping techniques which are based on linear theory fail to provide good performance over the whole voltage range. In this paper, we develop a new methodology for preshaping input commands applied to control electrostatically-actuated microdevices. To obtain the shaped input, the proposed technique utilizes the equations describing the static response of the device, an energy balance argument, and an approximate nonlinear analytical solution of the device response in an iterative manner. As an example, we consider set-point stabilization of an electrostatically-actuated torsional micromirror. The shaped commands are applied to drive the micromirror to a desired tilt angle with zero residual vibrations. Simulations reveal that fast mirror switching with almost zero overshoot can be realized using this technique. This approach can be further extended to shape input commands applied to other nonlinear micro and macro systems.