<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Windows on 桃语苑</title><link>https://www.whitepeach.top/tags/windows/</link><description>Recent content in Windows on 桃语苑</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><lastBuildDate>Fri, 17 Jan 2025 09:19:38 +0000</lastBuildDate><atom:link href="https://www.whitepeach.top/tags/windows/index.xml" rel="self" type="application/rss+xml"/><item><title>Windows10 PowerShell升级美化指北（喂饭级教程）</title><link>https://www.whitepeach.top/post/windows10-powershell-upgrade/</link><pubDate>Fri, 17 Jan 2025 09:19:38 +0000</pubDate><guid>https://www.whitepeach.top/post/windows10-powershell-upgrade/</guid><description>&lt;img src="https://www.whitepeach.top/post/windows10-powershell-upgrade/cover.png" alt="Featured image of post Windows10 PowerShell升级美化指北（喂饭级教程）" />&lt;p>Windows PowerShell 是一种易于使用的命令行 shell 和脚本环境，用于自动执行基于 Windows 的系统的管理任务。 Windows PowerShell 预安装在 Windows 操作系统的所有新式版本上。&lt;br>
但是win10默认的powershell5.1太丑了——如图：&lt;figure class="wp-block-image size-full">&lt;/p>
&lt;p>&lt;img loading="lazy" decoding="async" width="536" height="329" src="https://img.whitepeach.top/1737016626-image.png" alt="" class="wp-image-104" srcset="https://img.whitepeach.top/1737016626-image.png 536w, https://img.whitepeach.top/1737016626-image-300x184.png 300w" sizes="auto, (max-width: 536px) 100vw, 536px" /> &lt;/figure>&lt;/p>
&lt;p>🎈美化后的效果展示：&lt;figure class="wp-block-image size-large">&lt;/p>
&lt;p>&lt;img loading="lazy" decoding="async" width="1024" height="570" src="https://img.whitepeach.top/1737103732-image-1024x570.png" alt="" class="wp-image-126" srcset="https://img.whitepeach.top/1737103732-image-1024x570.png 1024w, https://img.whitepeach.top/1737103732-image-300x167.png 300w, https://img.whitepeach.top/1737103732-image-768x428.png 768w, https://img.whitepeach.top/1737103732-image.png 1235w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /> &lt;/figure>&lt;/p>
&lt;h2 id="食材准备">👨‍🍳食材准备：
&lt;/h2>&lt;p>首先放出官网的链接:&lt;/p>
&lt;ul>
&lt;li>PowerShell7: &lt;a class="link" href="https://github.com/PowerShell/PowerShell" target="_blank" rel="noopener"
>PowerShell/PowerShell: PowerShell for every system!&lt;/a>&lt;/li>
&lt;li>Nerd Fonts: &lt;a class="link" href="https://www.nerdfonts.com/font-downloads" target="_blank" rel="noopener"
>Nerd Fonts - Iconic font aggregator, glyphs/icons collection, &amp;amp; fonts patcher&lt;/a>&lt;/li>
&lt;li>oh my posh: &lt;a class="link" href="https://ohmyposh.dev/" target="_blank" rel="noopener"
>Home | Oh My Posh&lt;/a>&lt;/li>
&lt;/ul>
&lt;h2 id="一安装powershell7">一、安装PowerShell7：
&lt;/h2>&lt;p>PowerShell 版本 7 不是 Windows PowerShell 5.1 的替代项;它与 Windows PowerShell 并行安装。 Windows PowerShell 版本 5.1 和 PowerShell 版本 7 是两种不同的产品。&lt;/p>
&lt;p>首先需要确认一下PowerShell的版本：&lt;br>
打开Power Shell并输入 &lt;code>$PSVersionTable&lt;/code> 显示版本如下图所示&lt;br>
其中PSVersion 就是我们的PowerShell版本了，可以看到我这里的版本是5.1，win10默认的版本就是5.1，随后我们需要将其升级到7.x&lt;figure class="wp-block-image size-full">&lt;/p>
&lt;p>&lt;img loading="lazy" decoding="async" width="534" height="332" src="https://img.whitepeach.top/1737017693-image.png" alt="" class="wp-image-105" srcset="https://img.whitepeach.top/1737017693-image.png 534w, https://img.whitepeach.top/1737017693-image-300x187.png 300w" sizes="auto, (max-width: 534px) 100vw, 534px" /> &lt;/figure>&lt;/p>
&lt;p>&lt;strong>有两种安装方式&lt;/strong>（推荐第一种比较省事）&lt;br>
&lt;strong>第一种&lt;/strong>: 直接打开Microsoft Store 搜索PowShell，点击安装，然后你就完成了一次酣畅淋漓的安装&lt;figure class="wp-block-image size-large">&lt;/p>
&lt;p>&lt;img loading="lazy" decoding="async" width="1024" height="797" src="https://img.whitepeach.top/1737017841-a3a5cfd506f991fd3b7c11d2bc22153e-1024x797.png" alt="" class="wp-image-106" srcset="https://img.whitepeach.top/1737017841-a3a5cfd506f991fd3b7c11d2bc22153e-1024x797.png 1024w, https://img.whitepeach.top/1737017841-a3a5cfd506f991fd3b7c11d2bc22153e-300x233.png 300w, https://img.whitepeach.top/1737017841-a3a5cfd506f991fd3b7c11d2bc22153e-768x598.png 768w, https://img.whitepeach.top/1737017841-a3a5cfd506f991fd3b7c11d2bc22153e.png 1298w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /> &lt;/figure> &lt;figure class="wp-block-image size-large">&lt;img loading="lazy" decoding="async" width="1024" height="797" src="https://img.whitepeach.top/1737017877-4e0a6c494afd6efe14d91065796ca267-1024x797.png" alt="" class="wp-image-107" srcset="https://img.whitepeach.top/1737017877-4e0a6c494afd6efe14d91065796ca267-1024x797.png 1024w, https://img.whitepeach.top/1737017877-4e0a6c494afd6efe14d91065796ca267-300x233.png 300w, https://img.whitepeach.top/1737017877-4e0a6c494afd6efe14d91065796ca267-768x598.png 768w, https://img.whitepeach.top/1737017877-4e0a6c494afd6efe14d91065796ca267.png 1298w" sizes="auto, (max-width: 1024px) 100vw, 1024px" />&lt;/figure>&lt;/p>
&lt;p>&lt;strong>第二种&lt;/strong>就是从官方的Github库下载，链接在上文中，从releases中选择一个版本安装，建议不要安装预发布版，也就是右侧带有Pre-releases小黄图标的版本&lt;/p>
&lt;div class="wp-block-image">
&lt;figure class="aligncenter size-full">&lt;img loading="lazy" decoding="async" width="107" height="55" src="https://img.whitepeach.top/1737018133-image.png" alt="" class="wp-image-108" />&lt;/figure>
&lt;/div>
&lt;p>一般选择latest即可，例如我这里选择的就是V7.4.6&lt;/p>
&lt;div class="wp-block-image">
&lt;figure class="aligncenter size-full">&lt;img loading="lazy" decoding="async" width="582" height="135" src="https://img.whitepeach.top/1737018251-image.png" alt="" class="wp-image-109" srcset="https://img.whitepeach.top/1737018251-image.png 582w, https://img.whitepeach.top/1737018251-image-300x70.png 300w" sizes="auto, (max-width: 582px) 100vw, 582px" />&lt;/figure>
&lt;/div>
&lt;p>下载你的操作系统对应的构建，一般跟我一样选择win-x64即可，msi是引导安装软件形式，zip是无需安装解压即用形式，理论上都可以，这里选择软件安装不用自己配置环境变量&lt;figure class="wp-block-image size-full">&lt;/p>
&lt;p>&lt;img loading="lazy" decoding="async" width="875" height="68" src="https://img.whitepeach.top/1737018353-image.png" alt="" class="wp-image-110" srcset="https://img.whitepeach.top/1737018353-image.png 875w, https://img.whitepeach.top/1737018353-image-300x23.png 300w, https://img.whitepeach.top/1737018353-image-768x60.png 768w" sizes="auto, (max-width: 875px) 100vw, 875px" /> &lt;/figure>&lt;/p>
&lt;p>下载完成打开后傻瓜式安装&lt;s>（一路NEXT总不会有人不会吧）&lt;/s>&lt;/p>
&lt;div class="wp-block-image">
&lt;figure class="aligncenter size-full">&lt;img loading="lazy" decoding="async" width="495" height="387" src="https://img.whitepeach.top/1737018680-image.png" alt="" class="wp-image-111" srcset="https://img.whitepeach.top/1737018680-image.png 495w, https://img.whitepeach.top/1737018680-image-300x235.png 300w" sizes="auto, (max-width: 495px) 100vw, 495px" />&lt;/figure>
&lt;/div>
&lt;p>安装后你的菜单应该会出现PowerShell7，或者你也可以用WIN+R组合键打开pwsh，如下图所示，正常情况会自动输出版本号，如果跟下载安装的版本号一样就是安装成功了&lt;/p>
&lt;div class="wp-block-group is-nowrap is-layout-flex wp-container-core-group-is-layout-ad2f72ca wp-block-group-is-layout-flex">
&lt;div class="wp-block-image">
&lt;figure class="aligncenter size-full">&lt;img loading="lazy" decoding="async" width="266" height="93" src="https://img.whitepeach.top/1737019313-image.png" alt="" class="wp-image-113" />&lt;/figure>
&lt;/div>&lt;figure class="wp-block-image size-full">
&lt;p>&lt;img loading="lazy" decoding="async" width="399" height="230" src="https://img.whitepeach.top/1737019382-image.png" alt="" class="wp-image-114" srcset="https://img.whitepeach.top/1737019382-image.png 399w, https://img.whitepeach.top/1737019382-image-300x173.png 300w" sizes="auto, (max-width: 399px) 100vw, 399px" />&lt;/figure>&lt;/p>
&lt;/div>&lt;figure class="wp-block-image size-full">
&lt;p>&lt;img loading="lazy" decoding="async" width="859" height="512" src="https://img.whitepeach.top/1737019562-image.png" alt="" class="wp-image-115" srcset="https://img.whitepeach.top/1737019562-image.png 859w, https://img.whitepeach.top/1737019562-image-300x179.png 300w, https://img.whitepeach.top/1737019562-image-768x458.png 768w" sizes="auto, (max-width: 859px) 100vw, 859px" /> &lt;/figure>&lt;/p>
&lt;p>🎉恭喜到这里我们就完成PowerShell7的安装了&lt;/p>
&lt;h2 id="二安装oh-my-posh">二、安装oh-my-posh
&lt;/h2>&lt;p>oh-my-posh是一个shell个性化工具，官方描述为适用于任何 shell 的提示主题引擎。&lt;/p>
&lt;p>安装方式同样与PowerShell大差不差，也可以从微软商店和从GitHub下载，官方文档还会让你使用winget下载，想尝试的小伙伴可以自己折腾一下&lt;br>
用微软商店安装（建议）：&lt;figure class="wp-block-image size-large">&lt;/p>
&lt;p>&lt;img loading="lazy" decoding="async" width="1024" height="800" src="https://img.whitepeach.top/1737020370-image-1024x800.png" alt="" class="wp-image-116" srcset="https://img.whitepeach.top/1737020370-image-1024x800.png 1024w, https://img.whitepeach.top/1737020370-image-300x234.png 300w, https://img.whitepeach.top/1737020370-image-768x600.png 768w, https://img.whitepeach.top/1737020370-image.png 1284w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /> &lt;/figure>&lt;/p>
&lt;p>从&lt;a href="https://github.com/JanDeDobbeleer/oh-my-posh/releases" target="_blank" rel="nofollow" >GitHub release&lt;/a> 下载：&lt;figure class="wp-block-image size-full">&lt;/p>
&lt;p>&lt;img loading="lazy" decoding="async" width="939" height="835" src="https://img.whitepeach.top/1737021549-image.png" alt="" class="wp-image-117" srcset="https://img.whitepeach.top/1737021549-image.png 939w, https://img.whitepeach.top/1737021549-image-300x267.png 300w, https://img.whitepeach.top/1737021549-image-768x683.png 768w" sizes="auto, (max-width: 939px) 100vw, 939px" /> &lt;/figure>&lt;/p>
&lt;p>使用 &lt;code>oh-my-posh --version&lt;/code> 检验安装&lt;figure class="wp-block-image size-large">&lt;/p>
&lt;p>&lt;img loading="lazy" decoding="async" width="1024" height="589" src="https://img.whitepeach.top/1737098038-image-1024x589.png" alt="" class="wp-image-119" srcset="https://img.whitepeach.top/1737098038-image-1024x589.png 1024w, https://img.whitepeach.top/1737098038-image-300x173.png 300w, https://img.whitepeach.top/1737098038-image-768x442.png 768w, https://img.whitepeach.top/1737098038-image.png 1099w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /> &lt;/figure>&lt;/p>
&lt;p>接下来就需要配置oh-my-posh了，有能力的朋友可以参照&lt;a href="https://ohmyposh.dev/docs/" target="_blank" rel="nofollow" >官方文档&lt;/a>按照自己的喜好配置。&lt;br>
oh-my-posh被设计为使用 Nerd 字体。 Nerd 字体是流行的字体，经过修补以包含图标。要想看见 oh-my-posh 中显示的图标，我们需要安装Nerd Font。&lt;br>
这里可以在&lt;a href="https://www.nerdfonts.com/font-downloads" target="_blank" rel="nofollow" >Nerd Font&lt;/a>选择一个自己喜欢的字体下载，当然oh-my-posh也内置了字体下载CLI，只需要在shell键入 &lt;code>oh-my-posh font install&lt;/code> 即可选择下载自己需要的字体&lt;figure class="wp-block-image size-large">&lt;/p>
&lt;p>&lt;img loading="lazy" decoding="async" width="1024" height="531" src="https://img.whitepeach.top/1737100749-image-1024x531.png" alt="" class="wp-image-120" srcset="https://img.whitepeach.top/1737100749-image-1024x531.png 1024w, https://img.whitepeach.top/1737100749-image-300x156.png 300w, https://img.whitepeach.top/1737100749-image-768x398.png 768w, https://img.whitepeach.top/1737100749-image.png 1219w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /> &lt;/figure>&lt;/p>
&lt;p>然后我们需要创建一个配置文件，使用 &lt;code>New-Item -Path $PROFILE -Type File -Force&lt;/code> 创建一个新的配置文件，使用任意文本编辑器打开它，例如：&lt;code>notepad $PROFILE&lt;/code> 或 code $PROFILE&lt;figure class="wp-block-image size-large">&lt;/p>
&lt;p>&lt;img loading="lazy" decoding="async" width="1024" height="589" src="https://img.whitepeach.top/1737101922-image-1024x589.png" alt="" class="wp-image-121" srcset="https://img.whitepeach.top/1737101922-image-1024x589.png 1024w, https://img.whitepeach.top/1737101922-image-300x173.png 300w, https://img.whitepeach.top/1737101922-image-768x442.png 768w, https://img.whitepeach.top/1737101922-image.png 1099w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /> &lt;/figure>&lt;/p>
&lt;p>向配置中写入&lt;code>oh-my-posh init pwsh | Invoke-Expression&lt;/code>&lt;br>
这条命令用于初始化和配置 &lt;code>oh-my-posh&lt;/code>&lt;/p>
&lt;ul>
&lt;li>&lt;code>oh-my-posh init pwsh&lt;/code>：这部分命令初始化 &lt;code>oh-my-posh&lt;/code> 并指定使用 PowerShell (&lt;code>pwsh&lt;/code>) 作为 shell。&lt;/li>
&lt;li>&lt;code>Invoke-Expression&lt;/code>：这部分命令将前面的输出作为 PowerShell 命令来执行。&lt;br>
整体上，这条命令的作用是加载并应用 &lt;code>oh-my-posh&lt;/code> 的配置。&lt;br>
在vscode的shell也能看见效果&lt;figure class="wp-block-image size-large">&lt;/li>
&lt;/ul>
&lt;p>&lt;img loading="lazy" decoding="async" width="1024" height="710" src="https://img.whitepeach.top/1737102520-image-1024x710.png" alt="" class="wp-image-122" srcset="https://img.whitepeach.top/1737102520-image-1024x710.png 1024w, https://img.whitepeach.top/1737102520-image-300x208.png 300w, https://img.whitepeach.top/1737102520-image-768x533.png 768w, https://img.whitepeach.top/1737102520-image.png 1168w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /> &lt;/figure>&lt;/p>
&lt;p>🎉至此整个shell已经比最开始好看很多了，接下来可以进行一些进一步的个性化配置&lt;/p>
&lt;h2 id="三其他配置">三、其他配置
&lt;/h2>&lt;p>&lt;strong>配合Terminal使用：&lt;/strong>&lt;br>
同样微软商店下载即可，然后你就获得了一个win11同款terminal，可以在设置中设置亚克力背景等，留给各位自行探索。&lt;figure class="wp-block-image size-large">&lt;/p>
&lt;p>&lt;img loading="lazy" decoding="async" width="1024" height="800" src="https://img.whitepeach.top/1737103000-image-1024x800.png" alt="" class="wp-image-123" srcset="https://img.whitepeach.top/1737103000-image-1024x800.png 1024w, https://img.whitepeach.top/1737103000-image-300x234.png 300w, https://img.whitepeach.top/1737103000-image-768x600.png 768w, https://img.whitepeach.top/1737103000-image.png 1284w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /> &lt;/figure> &lt;figure class="wp-block-image size-full">&lt;img loading="lazy" decoding="async" width="893" height="604" src="https://img.whitepeach.top/1737103052-image.png" alt="" class="wp-image-124" srcset="https://img.whitepeach.top/1737103052-image.png 893w, https://img.whitepeach.top/1737103052-image-300x203.png 300w, https://img.whitepeach.top/1737103052-image-768x519.png 768w" sizes="auto, (max-width: 893px) 100vw, 893px" />&lt;/figure>&lt;/p>
&lt;p>&lt;strong>主题配置&lt;/strong>：&lt;br>
使用 &lt;code>Get-PoshThemes&lt;/code> 命令可以获取主题预览，应用主题配置只需要修改上面的配置文件为（以jandedobbeleer示例）&lt;/p>
&lt;pre class="wp-block-code">&lt;code>oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH/jandedobbeleer.omp.json" | Invoke-Expression&lt;/code>&lt;/pre>&lt;figure class="wp-block-image size-full">
&lt;p>&lt;img loading="lazy" decoding="async" width="873" height="434" src="https://img.whitepeach.top/1737103235-image.png" alt="" class="wp-image-125" srcset="https://img.whitepeach.top/1737103235-image.png 873w, https://img.whitepeach.top/1737103235-image-300x149.png 300w, https://img.whitepeach.top/1737103235-image-768x382.png 768w" sizes="auto, (max-width: 873px) 100vw, 873px" /> &lt;/figure> &lt;figure class="wp-block-image size-large">&lt;img loading="lazy" decoding="async" width="1024" height="570" src="https://img.whitepeach.top/1737103732-image-1024x570.png" alt="" class="wp-image-126" srcset="https://img.whitepeach.top/1737103732-image-1024x570.png 1024w, https://img.whitepeach.top/1737103732-image-300x167.png 300w, https://img.whitepeach.top/1737103732-image-768x428.png 768w, https://img.whitepeach.top/1737103732-image.png 1235w" sizes="auto, (max-width: 1024px) 100vw, 1024px" />&lt;/figure>&lt;/p>
&lt;p>其他还有很多可以优化&lt;s>（折腾）&lt;/s>的配置，就留给各位朋友自行探索吧&lt;/p>
&lt;h3 id="恭喜到这里你的终端就配置好了">🎉恭喜！到这里你的终端就配置好了！
&lt;/h3></description></item></channel></rss>