Just make a new address on your fresh formated pc so you'll have a safe wallet. Electrum does not use wallet.dat but a seed that let's you recover your whole wallet information.
I know that, I meant for the other altcoins. How do I do ?
if you mean saving the wallet.dat?
do a backup before formatting, then put it again in roaming folder, this must be done for every altcoin
to avoid dowloading again the altcoin blockchain, you can save the whole folder in the roaming, for example for doge, save the folder named doge in %appdata%, then format(install OS), and then copy it again in the roaming folder