My Dell XPS M1530 boots intermittently

Fatima2012

TS Rookie
Hi I have a Dell XPS M1530. Sometimes it boots, other times Windows appears to be loading but the screen is black. When it boots I am informed that the battery needs replacing. I have no problem replacing the batteries but I am not sure this is the solution. If the laptop is plugged into a mains supply I would expect it to boot regardless of whether the batteries needs replacing or is this not the case?

thanks
Fatima