please provide proper information before we can even help you.
We have no idea what piece of technology you are using. Seeing as how one of the tags is Windows XP and you are talking about a battery, I would have to assume a laptop. But which laptop?
Also, when you say your battery can only work when you connect a power cable, you do know that this has nothing to do with your battery.
Once connected to a power cable, your laptop will be powered directly from the cable and not the battery while the battery also charges.
Again, assuming that you are using a laptop and that the battery doesn't turn on when only using the battery, it could be because of a couple of things.
#1: Your battery is receiving a charge but your PC doesn't want to use the battery to turn on.
If this is the case then removing the battery from the laptop and holding the power button for 30 seconds and putting the battery back in can fix this sometimes.
#2: same thing as #1 but the connectors for the battery on the laptop are bad and there's nothing you can do about that. Chances that this is the case are extremely slim and not likely.
#3: Your battery doesn't receive a charge because it is bad and therefore your system will not operate with just the battery.
Solution would be to get a new battery.
If my assumptions about you using a laptop and wanting information about the battery on it are wrong and your post is for something else entirely, then please feel free to actually post something that tells us what is wrong and the hardware you are having trouble with so that we may properly be able to assist you.