Powershell配置
Windows10 Powershell 设置
首先Powershell的用户配置在用户目录的Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
文件中。
美化需要安装一些插件,在windows平台上脚本的执行策略必须是
RemoteSigned
或者Unrestricted
,可以使用Get-ExecutePolicy
检查powershell脚本的执行策略。如果在安装的过程中出现脚本执行策略的问题,可以用Set-ExecutionPolicy
设置脚本执行策略,例如 ,可以用如下命令Set-ExecutionPolicy Unrestricted -Scope CurrentUser
将当前用户的脚本执行策略设置为Unrestricted
。
推荐的插件
scoop(https://github.com/lukesampson/scoop)
scoop 是windows平台中的一个包管理器。
安装
|
|
posh-git(https://github.com/dahlbyk/posh-git)
安装
-
使用
Install-Module
命令安装1
PowerShellGet\Install-Module posh-git -Scope CurrentUser -AllowPrerelease -Force
-
使用scoop 安装
1 2
scoop install posh-git Add-PoshGitToProfile
oh-my-posh(https://github.com/JanDeDobbeleer/oh-my-posh)
安装
|
|
oh-my-posh 中的一些主题可能需要powerline字体,安装过程参考https://github.com/powerline/fonts。
Get-ChildItemColor(https://github.com/joonro/Get-ChildItemColor)
安装
|
|
一个示例配置文件
|
|
配置后的效果图如下:
- 原文作者:SilentStorm
- 原文链接:https://silentstormic.top/post/Powershell%E9%85%8D%E7%BD%AE/
- 版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 4.0 国际许可协议进行许可,非商业转载请注明出处(作者,原文链接),商业转载请联系作者获得授权。