首先需要安装Chocolatey:

    1. Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

    安装Oh-my-posh,下面命令挨个执行:

    1. choco install ConEmu
    2. Install-Module posh-git -Scope CurrentUser
    3. Install-Module oh-my-posh -Scope CurrentUser

    关闭脚本禁用:允许Powershell运行脚本:

    1. set-executionpolicy remotesigned

    设置Profile脚本

    1. if (!(Test-Path -Path $PROFILE )) { New-Item -Type File -Path $PROFILE -Force }
    2. notepad $PROFILE

    打开生成的文件,加入下面代码:

    1. Import-Module posh-git
    2. Import-Module oh-my-posh
    3. Set-Theme tehrob

    默认支持以下主题:

    1. Name Type Location
    2. ---- ---- --------
    3. Agnoster Defaults C:\Users\quanzaiyu\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.399\Themes\Agnoster.psm1
    4. Avit Defaults C:\Users\quanzaiyu\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.399\Themes\Avit.psm1
    5. Darkblood Defaults C:\Users\quanzaiyu\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.399\Themes\Darkblood.psm1
    6. Fish Defaults C:\Users\quanzaiyu\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.399\Themes\Fish.psm1
    7. Honukai Defaults C:\Users\quanzaiyu\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.399\Themes\Honukai.psm1
    8. Paradox Defaults C:\Users\quanzaiyu\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.399\Themes\Paradox.psm1
    9. Powerlevel10k-Classic Defaults C:\Users\quanzaiyu\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.399\Themes\Powerlevel10k-Classic.psm1
    10. Powerlevel10k-Lean Defaults C:\Users\quanzaiyu\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.399\Themes\Powerlevel10k-Lean.psm1
    11. PowerLine Defaults C:\Users\quanzaiyu\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.399\Themes\PowerLine.psm1
    12. pure Defaults C:\Users\quanzaiyu\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.399\Themes\pure.psm1
    13. robbyrussell Defaults C:\Users\quanzaiyu\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.399\Themes\robbyrussell.psm1
    14. Sorin Defaults C:\Users\quanzaiyu\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.399\Themes\Sorin.psm1
    15. tehrob Defaults C:\Users\quanzaiyu\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.399\Themes\tehrob.psm1

    设置为tehrob后:

    1. quanzaiyu :: ~\Desktop\temp »

    安装个性化字体,支持特殊符号:https://github.com/adam7/delugia-code/releases/download/v1910.04.1/Delugia.Nerd.Font.Complete.ttf