For PowerShell scripts to be run from File Explorer it’s important that they not closed automatically.
I am adding to those scripts
if ($host.name -eq ‘ConsoleHost’)
Read-Host -Prompt “Press_Enter_to_continue”
Recently I found in http://www.howtogeek.com/204166/how-to-configure-windows-to-work-with-powershell-scripts-more-easily/
Alternately, we can modify the “(Default)” values for our Command keys to include the “-NoExit” parameter.
First I decided,that it is a good idea,and added
Set-ItemProperty HKCR:\Microsoft.PowerShellScript.1\Shell\Command ‘(Default)’ ‘”C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe” “-NoExit” “-ExecutionPolicy” “RemoteSigned” “-file” “%1″‘
But then I realized, that if PowerShell script should be shared with other users, it’s better to explicitly implement pause in a script rather then rely on registry setting on other machines.