Conceptual understanding of how a battery ensures that a capacitor has the same potential difference as it? I was wondering how exactly a battery is able to ensure that a capacitor connected to it would have the same potential difference as it.
Like, thinking about a battery similarly to a capacitor, I assumed that the potential difference of the battery could be represented by the integral of the electric field between the battery's terminals across the distance separating them. Which would be created by the charges that build up in the battery's terminals.
However, if you attached a capacitor and started moving the plates closer together/father away from each other then the charge in the plates would vary significantly but the charge in the terminals of the battery would remain constant.
But, in order to move the charges you would have to exert some net electric field on them which I don't see how the battery is doing, since moving the plates of the capacitor (assuming the capacitor is significantly far away from the battery) doesn't seem like it would have any effect on the battery itself that would cause it to exert some reactionary force on the charges on the plates of the capacitor to move them.
 A: 
I was wondering how exactly a battery is able to ensure that a
capacitor connected to it would have the same potential difference as
it.

The battery has to do work to move charge from one plate of the capacitor to the other. The work the battery does per unit charge to move the charge between the plates equals the potential difference $V$ between two plates.
The battery can perform this work until the potential difference between the plates equals the battery emf. At that point the battery emf equals the potential difference between the capacitor plates and the battery is no longer capable of performing additional work to move additional charge between the plates. The capacitor is then fully charged.

However, if you attached a capacitor and started moving the plates
closer together/father away from each other then the charge in the
plates would vary significantly but the charge in the terminals of the
battery would remain constant.

The relationship between voltage $V$, capacitance $C$ and charge $Q$ for a capacitor is
$$C=\frac{Q}{V}$$
The capacitance between parallel plates as a function of plate separation $d$ is
$$C=\frac{eA}{d}$$
Where $e$ is the electrical permittivity of the dielectric between the plates, $A$ is the area of the plates, and $d$ is the distance between the plates.
For a given plate area $A$ and electrical permittivity $e$ increasing or decreasing or increasing the plate separation $d$ decreases or increases the capacitance, respectively. That means moving the plates closer together while the capacitor is connected to the battery of voltage $V$ increases the capacitance.  So if the voltage across the capacitor is fixed at $V$, the net charge  on the plates must increase.

But, in order to move the charges you would have to exert some net
electric field on them which I don't see how the battery is doing,
since moving the plates of the capacitor (assuming the capacitor is
significantly far away from the battery) doesn't seem like it would
have any effect on the battery itself that would cause it to exert
some reactionary force on the charges on the plates of the capacitor
to move them.

I'm having a little trouble following this.
The internal battery emf is fixed and does not depend on the capacitance of the capacitor connected to it (i.e., does not depend on the plate separation $d$). But changing the plate separation (changing the capacitance) will change the net charge $Q$ on the plates for the given emf.
In any event, the electric field $E$ between the capacitor plates is
$$E=\frac{V}{d}$$
So if the battery voltage is fixed, decreasing or increasing the plate separation $d$ increases or decreases the electric field between the plates, respectively.
Hope this helps.
A: Suppose that we quickly push the capacitor plates closer. There will be some resistance in the circuit (even if only the internal resistance of the battery), so charge cannot flow instantaneously and the charges on the capacitor plates will not at first change much. Thus the electric field between the plates won't, either – at first. So the pd $V$ between the plates will fall ($V=Ed$) below the emf, $\mathscr E$, of the battery. The difference between $\mathscr E$ and $V$ will drive current through the resistance, so the charge on the plates will increase. This will go on until $V$ is equal to $\mathscr E$.
