Cities, and most infrastructure CAN be powered by solar.
Which cites don't need electricity for sixteen hours out of every twenty four, or on cloudy days?
Those with a good supply of batteries to store surplus power during downtimes, I presume.
The world's largest batteries can supply ~300MW for maybe 4 hours. New York City uses about 5,500MW; To power NYC for sixteen hours, you therefore require around twenty of these batteries, assuming that you get no cloud cover over the 16,500MW (roughly 100,000 sq m) of solar panels needed to both power the city and recharge the batteries.
Such batteries are hugely expensive; Use vast amounts of materials to construct, (leading to massive environmental damage); Are very dangerous (they
frequently catch fire, and release significant amounts of toxic smoke when they do); And are each less than 5% of the most generous estimates of the size required to do the job for a single large city.
What you call a "good supply" of batteries for every city in the world would require environmental destruction on a scale that makes carbon dioxide emissions look like a trivial concern.
Imaginary batteries are only a solution to pretend problems. In the real world, we cannot possibly solve the storage problem inherent to intermittent electricity generation, because storage solutions are physically limited by the same energy density constraints that apply to all chemical reactions. In short, to replace billions of tonnes of coal burning, we will inevitably need billions of tonnes of energy storage facilities.
Or we could stop pissing around with the electromagnetic force, and go to the far higher energy densities inherent in the use if the strong nuclear force.
Batteries (plus the solar or wind power to charge them) might be worth pursuing, if we didn't have anything better. But nuclear fission is FAR better by pretty much every possible measure, from safety, through environmental impact, to cost. Literally the only measure by which it's not vastly superior is public opinion.
"There is nothing so useless as doing, with great efficiency, that which should not be done at all" - Peter Drucker.