Look at the following Adobe list of where the various settings files are located, find the settings you want to preserve, and copy those files to a backup location. When you want to restore them, copy the same files back into their original locations.
https://helpx.adobe.com/photoshop/kb/preference-file-names-locations-photoshop.html
If you really are using Photoshop CS5 which is rather old, the locations in that list may not be the same because they’re for the current version. I am not sure if they still have the list of where everything is for Photoshop CS5.