Capacitors act like open circuit

Capacitors and Inductors
Their responses to changes in voltage

A sudden change in voltage can occur when a switch is closed or opened. It can also occur when a squarewave is present. (The following properties don't apply to gradual changes, such as occur when there is a sinewave present.)