A category of mesoporous carbons-that covers pristine CMK-3, micropore-enriched CMK-3, nitrogen-doped CMK-3 and a combination of nitrogen-doped and micropore- enriched CMK-3 has been prepared via a one-pot wet-impregnation method, using SBA-15 as mesopore template, phenolic resol as carbon precursor, silicate oligomer as micropore template, and nitrogen-rich hexamethoxymethylmelamine as nitrogen precursor. The synthesis is very flexible to control the pore structure and nitrogen doping of the carbons by changing the initial composition of the precursors. The structural similarity of these materials allow them to serve as model systems for mesoporous carbons in general, to comparatively illustrate the enhanced supercapacitor and Li-S cathode properties by nitrogen doping and micropore development. It is found that additional microporosity prevails over the nitrogen doping on the electrostatic adsorption for supercapacitor, while nitrogen doping performs better on the trapping polysulfide species especially at high current rates for Li-S cathode. Simultaneous creation of microporosity and nitrogen doping into mesoporous carbons could combine the synergistic effects, thus greatly improving the electrochemical properties both for supercapacitors and Li-S cathode.