PowerShell 美化

操作環境

Windows 10

更換 Sarasa Gothic 更紗黑體

  1. 進入 更紗黑體 GitHubrelease 頁面
  2. 選取 ttf 壓縮檔下載 ( sarasa-gothic-ttf-unhinted-0.34.1.7z) → 解壓縮 → 找到檔案 sarasa-mono-tc-regular.ttf 按右鍵安裝 。
    1. 字體中繁中就是有標註 tc 的。
  3. 重新啟動 PowerShell → 內容 → 字型,就可以選取 “ 等距更紗黑體 “ 囉 !

PowerShell

oh-my-posh | 增加提示條

oh-my-posh GitHub

  1. 於 PowerShell 輸入以下指令,第一次安裝遇到問題直接輸入 Y 即可。

    1
    Install-Module posh-git -Scope CurrentUser

    PowerShell1

  2. 安裝 oh-my-posh 模組,過程一路按 Y。

    1
    Install-Module oh-my-posh -Scope CurrentUser

    PowerShell2

  3. 設定自動套用,每次啟動 PowerShell 就可以子動套入設定。

    1. 於 PowerShell 輸入 $profile 來顯示 PowerShell 自定義路徑

      PowerShell3

    2. 複製 C:\Users\WIN10\OneDrive\文件\WindowsPowerShell 開啟資料夾

    3. 找名為 Microsoft.PowerShell_profile.ps1 的檔案,如果沒有就自行新增,並把下方程式碼貼入。 ( oh-my-posh 改版後 Set-Theme Agnoster 可更改為 Set-PoshPrompt -Theme Paradox ,就不會產生無法辨識的問題囉 ! )

      PowerShell4

      1
      2
      3
      Import-Module posh-git
      Import-Module oh-my-posh
      Set-PoshPrompt -Theme Paradox
    4. 記得重啟 PowerShell 。

      PowerShell5

參考文章