powershell - double-click to run

been new to PS and its behavior , now to know that whenever double-click on a ps1 script it will run and the console just goes away, you cannot see the output.

HOW TO FIX?

well you need to openup you registry and look for this path.

HKEY_CLASSES_ROOT\Microsoft.PowerShellScript.1\Shell\0\Command\

double-click on "Default' (right-pane) then enter this

"C:\windows\System32\WindowsPowerShell\v1.0\powershell.exe" "-NoExit" "-file" "%1" "-Command" "if((Get-ExecutionPolicy ) -ne AllSigned) { Set-ExecutionPolicy -Scope Process Bypass }"

what we are looking here is the parameter called  "-NoExit"

you can just added this in. - DONE!!!.

happy trying.


Comments