PowerShell in vim :terminal - setting the Execution Policy

317 views
Skip to first unread message

marco restelli

unread,
Feb 1, 2021, 8:05:57 AM2/1/21
to vim...@googlegroups.com
Hi all,
I want to run a Windows PowerShell in a vim :terminal.

If I start it with

:terminal powershell.exe

I do get a powershell in a terminal buffer, but the "Execution Policy"
is set to "Restricted", which among other things prevents souricing my
profile.ps1 file.

If I start a PowerShell from the "Start" menu, the policy is set to
"RemoteSigned", which is good. The executable being run is the same in
the two cases.

So, here are the questions:
1) how can I get the "RemoteSigned" policy also in the vim terminal instance?
2) why are the two policies different if I start the PowerShell from
the Start menu or inside a vim terminal?

Thank you,
Marco

Enno

unread,
Feb 6, 2021, 1:49:59 AM2/6/21
to vim_use
1. By `:terminal powershell.exe -ep RemoteSigned`
2. I do not know. Are you sure that the Start menu does not call `pwsh.exe` instead?

marco restelli

unread,
Feb 6, 2021, 3:04:47 PM2/6/21
to vim...@googlegroups.com
2021-02-06 7:49 GMT+01:00, Enno <enno....@gmail.com>:
> 1. By `:terminal powershell.exe -ep RemoteSigned`

Yes!

> 2. I do not know. Are you sure that the Start menu does not call `pwsh.exe`

No, it is powershell.exe, I guess because I am on version 5.1 and
pwsh.exe came with version 6.

Thank you, 1) actually solves my problem.

Marco
Reply all
Reply to author
Forward
0 new messages