When I turn on my Canon G6 power shot 7.1 megapixels it starts to work and then right when the camera turns on it turns off. I checked the batteries and they were fully charged. After the camera turns
Typically, when an electronic or electro-mechanical device - such as a computer or as in this case - your camera - is powered up; it goes through a "boot up" so to speak. Like your computer, the camera electronics performs some quick, basic checks on the electronic and mechanical systems during the boot up sequence. This often includes checking for the presence of a memory card, battery charge state, connection to a computer via USB cable - and - checking the lens position; and if it can be extended and reversed to a "home" position or not.
Because you're seeing a "lens" message, this is a clue that the camera boot up sequence has detected some sort of problem with the lens. Most often, the problem is tied to the lens not moving or not moving *fully* due to grit or sand lodged between 1) moving parts of the lens or 2) between moving parts of the lens and the stationary parts of the camera body itself. When you turn on the camera, does the lens move in and out - like it did before? If not, that is probably the cause. You can 1) send the camera to be repaired by Canon, 2) have a local repair shop attempt to fix it, 3) replace the camera with new - if it is older than a few years as it may not be worth the cost of investing $$ in old technology - or if this option is your plan, 4) attempt repair yourself. You have nothing to lose - you can try to help the lens extend by pulling while it s"boots" up if it is retracted - or pushing in on it if stuck in an extended position. That is the NORMAL test at boot - to extend then fully retract. You may get it to work, abd save the cost of repair or replacement - or you could damage the mechanism even more.
I hope this helps & good luck!