MacBook Pro keeps turning off while I'm updating it
today after a long time without having used my MacBook Pro I tried turning it on, but it had no battery, so I plugged it in. It turned on but it was very slow and didn't want to work right, it then shut off. So I turned it back on and it worked fine. Then whlie it was plugged in but only at 2% I Started to update it. My computer then restarted as it should and it started to load the update in the white screen with the apple logo, a gear. And a loading bar, it then gets to about one quarter of the way through and it shuts off. I turned it back on and it happened again. It has happened around 10 times and it won't go past a point without turning off.
I Need to know what I can do to get it to turn on again.
MacBook Pro, OS X Mavericks (10.9)