PowerShell基本配置
本文信息
创建时间: 2022.03.20 14:03:46
更新时间: 2023.08.16 22:34:47
进入PowerShell
查看当前PowerShell版本
输出:
PowerShell |
---|
| Name Value
---- -----
PSVersion 7.2.2
PSEdition Core
GitCommitId 7.2.2
OS Microsoft Windows 10.0.22000
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
|
创建/修改配置文件
PowerShell |
---|
| if (!(Test-Path -Path $PROFILE )) { New-Item -Type File -Path $PROFILE -Force }
notepad $PROFILE
|
此命令将使用Windows自带记事本打开powershell配置文件
查看PowerShell配置文件位置
输出:
PowerShell |
---|
| C:\Users\lzwang\Documents\PowerShell\Microsoft.PowerShell_profile.ps1
|
使用模块
在powershell的配置文件中,oh-my-posh
算作一个模块,如果要在powershell中使用,需要在配置文件中先导入。比如使用 PSReadLine
包,获得智能预测命令的能力,那么在启动文件中加入
参考
- PowerShell autocomplete and Windows Package Manager
- Windows Terminal 完美配置 PowerShell 7.1 - 知乎