Powershell script in Notepad works but not as .ps1

It works for me dragging a ps1 file to a lnk file that points to “%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe”, but the window will close when it’s done. Putting in pause worked to keep the window open. Here’s an example accent.ps1 script in the default “ansi” encoding:

'información'
pause

You can also add -noexit to the end of the powershell command in the shortcut.

Or you can drag the file to an open powershell window; it will paste the fullname of the script, and you can press return and run it without the window closing.

What happens if you open PowerShell, set-location to the location of the script you’ve saved and invoke it from the prompt?

PS C:\MyDir> .\MyScript.ps1