How to output the currently connected WiFi password directly with a PowerShell?

I want to output the currently connected WiFi password directly with one PowerShell command, but I have tried some methods without success. Also, I would like to adapt the terminal to multiple language environments, such as Chinese and English.

This is what I tried, but the output is the entire line of Key Content instead of just extracting the password string, which bothers me.

Netsh wlan show profile name=(Get-NetConnectionProfile -InterfaceAlias WLAN).Name key=clear | Select-String "(关键内容|Key Content)\W+\:(.+?)"

output:

Key Content: 12345678

The result I want is that I enter a ps command that outputs the WiFi password, 12345678


Parse the XML output from netsh wlan export profile instead:

# create a temporary folder for `netsh` to export to
$tmpFolderName = [System.IO.Path]::GetRandomFileName()
$tmpFolder = New-Item -Name $tmpFolderName -Type Directory

try {
  # export config to folder
  netsh wlan export profile name=(Get-NetConnectionProfile -InterfaceAlias WLAN).Name folder="$($tmpFolder.FullName)" key=clear 

  # parse resulting XML config
  $profileConfig = [xml]($tmpFolder |Get-ChildItem -Filter *.xml |Get-Content -Raw)

  # output key
  $profileConfig.WLANProfile.MSM.Security.sharedKey.keyMaterial
}
finally {
  # clean up
  $tmpFolder |Remove-Item -Recurse -Force
}