In Windows 10 and 8.1, you’ll have to use the command prompt to find a previous network’s password. Right-click the Start button and select “Command Prompt” to quickly open it.
Then type in the following command:
netsh wlan show profiles

You’ll get a list of the Wi-Fi networks you’ve accessed before.
To find the password for one of the profiles, type in the following, replacing profilename with the name of the profile:
netsh wlan show profile name=profilename key=clear
Look for the “Key Content” line to find the Wi-Fi password for that Wi-Fi network.

Reference:
https://www.howtogeek.com/233159/how-to-find-your-wi-fi-password/