  We present a local control scheme to construct the external potential v that,
for a given initial state, produces a prescribed time-dependent density in an
interacting quantum many-body system. The numerical method is efficient and
stable even for large and rapid density variations irrespective of the initial
state and the interactions. The method can at the same time be used to answer
fundamental v-representability questions in density-functional theory. In
particular, in the absence of interactions, it allows us to construct the exact
time-dependent Kohn-Sham potential for arbitrary initial states. We illustrate
the method in a correlated one-dimensional two-electron system with different
interactions, initial states and densities. For a Kohn-Sham system with a
correlated initial state we demonstrate the interplay between memory and
initial-state dependence as well as the failure of any adiabatic approximation.
