In this work, we investigate how and to which extent a quantum system can be driven along a prescribed path in Hilbert space by a suitably shaped laser pulse. To calculate the optimal, i.e., the variationally best pulse, a properly defined functional is maximized. This leads to a monotonically convergent algorithm which is computationally not more expensive than the standard optimalcontrol techniques to push a system, without specifying the path, from a given initial to a given final state. The method is successfully applied to drive the time-dependent density along a given trajectory in real space and to control the time-dependent occupation numbers of a two-level system and of a one-dimensional model for the hydrogen atom.