I have a strange problem with Visual Studio code related to selecting the default Powershell version: I have installed Powershell 5.1 and 7 parallely, but when I doubleclick on a ps1-file, it should automatically run the Powershell 5 console and execute the script.
This works flawlessly on my computer. However, as soon as I right-click a ps1-file and select "Open with" -> "VSCode", the file is opened in VS Code. When I now close VSCode and doubleclick the ps1-File in Windows Explorer again, the file will be opened in VSCode instead of Powershell 5 console, which is not my expected behaviour.
I believe that VSCode somehow changes the default handler for ps1-files from 5 to 7 in some way.
I have already tried to select the Windows powerShell as the default powerShell Extension in VSCode (by Clicking the plus button in the Terminal Window, Select Default Profile, and select Windows Powershell). This change seems to be completely ignored in VSCode, because I see from the console output that it always wants to open the ps1 file using PowerShell 7, instead of 5.
Do you have any idea how to get rid of this unexpected behaviour? Thank you!