I recently got an SSD so I uninstalled minecraft from my HDD C: Drive and onto my SSD D: Drive but even though the same file worked fine on my HDD, all of my minecraft versions (Specifically optifine which im trying to install now) wont show up in launcher. My "versions" folder in .minecraft has 3 different oftifine versions and none of them are showing in the launcher. I even made a replica versions folder on my C: drive with optifine to see if the launcher was defaulting to the .minecraft on my HDD but it still only showed Vanilla versions of the game
You may need to reinstall the locally installed files that Minecraft puts into place. To do so, press your Windows+R keys, type in %AppData% at the dialog, and press Enter. In the window that appears, open the .minecraft directory, and delete everything except for the saves directory that you see therein.
Next, go to Control Panel, and click on "Uninstall a Program" (may also be called "Programs and Features"). Then, right click on the Minecraft entry and select "Uninstall". Afterwards, restart your PC, then download and run the .msi at https://minecraft.net/en-us/download. Then, try running Minecraft again.[/p]