WinSCP is a great file manager program for logging into many different types of remote servers. It saves your sites into the Windows registry by default rather than a WInSCP.ini file like it used to long ago.

You can switch this option in your WinSCP Preferences. Options > Preferences > Storage > Automatic INI file or Custom INI file to save all the logins in an INI file instead. This makes it easier to back it up.

If you have saved it as INI before then it can be stored in either your C:\Users\USERNAME\AppData\Roaming\WinSCP.ini if you used the Automatic INI file setting or it seems the Custom INI file setting is C:\Users\USERNAME\Documents\WinSCP.ini by default.

To encrypt your passwords, which you definitely should do, go to Security in the Preferences window and set a master password there. You could use a password manager like Bitwarden to save your master password so you don’t lose it.

If you want to restore it from the registry because you didn’t do these things then first you have to have your files backed up and hope you have the right one. The file you want is C:\Users\USERNAME\NTUSER.DAT

If you don’t have this file then I suppose there isn’t much you can do besides add all your logins again. Hopefully you’ve saved it.

If you do have this file then here is a little trick to open it. First press Windows Key + R or right-click your start menu and go to Run and type in regedit and click Yes if it pops up a User Access Control screen asking if you want the app to make changes to your device. Once the Registry Editor opens don’t touch anything in here or you may blow up your computer!

If you really want to be cautious you can back up the registry. Do this by selecting Computer at the very top of the left panel and go to File > Export… and select where you want to store it then type in a file name and click Save. It is likely to be hundreds of megabytes in size. You should also secure or delete this file after we are done here because it contains sensitive information.

On the left panel under Computer left click on HKEY_LOCAL_MACHINE.

Now on the top menu go to File > Load Hive… and select that NTUSER.DAT file from your backup.

It will ask you to enter a Key Name. You can enter a unique name here such as TEMP123 and click OK. It has to be a unique name that won’t be found anywhere in your WinSCP settings or servers because we have to do a Replace All operation on this later and don’t want to accidentally remove something else that isn’t this folder name.

TEMP123 will be added to the list of folders under HKEY_LOCAL_MACHINE and you can browse it by clicking the arrows to the left of it or double-clicking the folder and name.

Browse to SOFTWARE\Martin Prikryl\WinSCP 2\Sessions or the full path of Computer\HKEY_LOCAL_MACHINE\TEMP123\SOFTWARE\Martin Prikryl\WinSCP 2\Sessions.

Select Sessions to highlight it and go to File > Export… and save the file somewhere and be sure you know where you’re saving it.

You can also export the entire Martin Prikryl folder the same way if you want all your settings and whatnot.

Now before you close the Registry Editor you’ll have to unload the file you just loaded. To do that click on the TEMP123 folder again to highlight it.

Go to File > Unload Hive… and click Yes.

Don’t close the Registry Editor just yet because we have to import that file. But first we have to remove the TEMP123 path from it by doing a search and replace on it which we can do in a text editor like Sublime Text.

Now open this file you just exported and if using Sublime Text press CTRL+H and enter \TEMP123 into the find field. Remove everything from the Replace field so it’s completely empty. Click Replace All and it should remove that path everywhere.

Now do another Replace All exactly the same as above but instead in the Find field enter HKEY_LOCAL_MACHINE and in the Replace field enter HKEY_CURRENT_USER

Save this either as the same file or as a new file if you wish.

Now back in the Registry Editor go to File > Import… and select that file you just saved and click Open.

This should have imported your data into Computer\HKEY_CURRENT_USER\SOFTWARE\Martin Prikryl. You can see all your sites at Computer\HKEY_CURRENT_USER\SOFTWARE\Martin Prikryl\WinSCP 2\Sessions. You can safely close the Registry Editor at this point.

Open up WinSCP and if everything went well it should have all your sites and settings ready to use again.

I should note that I can’t be 100% certain this would work on a completely fresh install of windows because in this case I did a reset using the Reset this PC feature in the Windows recovery settings so it kept a lot of my files. But if you backed things up properly then hopefully all will not be lost.

References:
https://winscp.net/eng/docs/faq_password
https://winscp.net/eng/docs/faq_transfer_config