Sustainability issues with batteries include making sure that the materials can be recycled into electrodes once they are no longer needed and that they have enough power to charge all devices. Existing technologies for material recovery and selective extraction continue to be inefficient and unsustainable. Here, N/S co-doping porous carbon materials comprising transitional-metal nanoparticles are synthesized through microstructural reconstruction from the waste layered cathode materials. The resultant three-dimensional (3D) porous carbon materials have various distinct and desirable structural characteristics and function admirably in potassium-ion batteries. The internal particle distribution, the interconnected carbon layer network, and the open-packed structure of microcapsules all contribute to the electrochemical transfer process. The proposed strategy offers almost zero-emission and pollution-free environment and can be extended to various spent lithium-ion batteries (LIBs) containing Li, Ni, Co, Mn, and other metals. The research may provide the potential to extend the environmental frontier for the development of energy materials.