Closing a switch in series with a capacitor Suppose we have the following circuit:

Such that for $t<0$ the switch M was open. If we close the switch at $t=0$ what will the voltage on the capacitor, $V_C$, be at $t=0^+$? What about $\dot V_C$ at $t=0^+$? Will there be a current passing through $R$ the moment the switch is closed?
I need to solve an ODE for a more complicated circuit which has this sub-circuit as a part of it, and I need initial conditions to solve for the ZIR case. I'm trying to figure out these initial conditions but I'm not sure. Here are my thoughts:
Before closing the switch, there will be a steady finite current $I$ in the circuit.The moment we close the switch, there can be no current passing through $R$, else there will be some finite voltage on the capacitor $\longrightarrow$ $\dot V_C$ will be infinite $\longrightarrow$ $I_C$=C$\cdot \dot V_C$ will be infinite which cannot be.
Therefore $V_C(t=0^+)=0$ and $\dot V_C(t=0^+)=I/C $. I'm not sure if what I said I correct, I mean we learned that if there is no impulse current (like Dirac's Delta function), the voltage on the capacitor will be continuous.Does this apply in the case too?  I would really appreciate any help.
 A: There are some mistakes with your assumptions. When $t<0$ a current $I =V/R$  will be flowing through resistor and no current would be flowing through capacitor. As soon we close the switch the capacitor will get charged instantaneously (yes it could lead to $I = \infty$ at $t=0$ but it can be avoided if even a small resistor is placed between capacitor and voltage source. And we can never get the resistance of those wires down to $0$). After $t=0$ a potential difference will develop across capacitor due to its charge. But a same current $I = V/R$ through the resistor as to satisfy Kirchhoff's loop rule in loop containing resistor and source. And because charge on capacitor will be constant after $t=0$ so will be the potential difference so $\dot{V_c}$ will be zero, not infinite and so will be the current through capacitor.
A: Let me tell you some notable points these should help you solve such problems from the competitive exam point of view:
=>A completely uncharged capacitor is like a wire, it offers 0 resistance
=>A fully charged capacitor is infinite resistance and no current flows through it
=>A battery that you have represented is an ideal battery and ideal batteries do not exist!!! To solve this question what you need to assume is that there is internal resistance of the cell that will be present.
=> The charging and discharging of capacitors is an exponential function which is very important from the physics point of view.    
The answer to your question :
If you deliberately wish to take an ideal battery then the time taken to charge a capacitor is 0, the current passing at the instant when the charging might have occurred is infinity, the voltage across the capacitor will be constant throughout because you just used an ideal circuit hence voltage across capacitor is constant.
Ideally in such a situation, the capacitor gets charged at t=0 which is illogical and impractical to occur.
A: You cannot solve the problem presented.
An ideal battery connected to a capacitor will have an initial current equal to infinity, which is obviously not possible. To make the problem solvable, you need to know the internal resistance of the battery.
Once you add the resistor in series with the battery, you will simply need to calculate the voltage across the parallel resistor (the maximum voltage you will across the capacitor).
$V_{t} = V_{max} e^{\frac{-t}{RC}}$
Where R is the resistance of the battery.
