查看本地策略
Get-ExecutionPolicy -List
如果是上图这种策略就不用改了,如果不是就需要输入
set-executionpolicy remotesigned
简单介绍一下五种策略
1、Restricted
默认的设置, 不允许任何脚本运行
2、AllSigned
只能运行经过数字证书签名的脚本;
3、RemoteSigned
运行本地的脚本不需要数字签名,但是运行从网络上下载的脚本就必须要有数字签名;
4、Unrestricted
允许所有的脚本运行;
5、Undefined
在Windows10下这是默认的值,表示未设置任何执行权限。这个值一般是用来删除执行策略的。
要删除特定范围的执行策略,请将执行策略设置为Undefined。
安装使用oh-my-posh
安装 posh-git 和 oh-my-posh 这两个模块
Install-Module posh-git -Scope CurrentUser
Install-Module oh-my-posh -Scope CurrentUser
新建编辑配置文件
PowerShell的所有配置文件路径存放在自动化变量$profile中,