Windows 10 系统PowerShell美化 IDEA终端、VsCode终端以及Windows Terminal的PowerShell

这篇具有很好参考价值的文章主要介绍了Windows 10 系统PowerShell美化 IDEA终端、VsCode终端以及Windows Terminal的PowerShell。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

Windows PowerShell 美化

前言

Linux 和 macOS 上的 PowerShell 使用 .NET Core,即 Microsoft Windows 上的完整 .NET Framework 的子集。 这非常重要,因为 PowerShell 提供对基础框架类型和方法的直接访问。 因此,在 Windows 上运行的脚本可能无法在非 Windows 平台上运行,因为框架之间存在差异。

Windows 终端程序是一款新式、快速、高效、强大且高效的终端应用程序,适用于命令行工具和命令提示符,PowerShell和 WSL 等 Shell 用户。主要功能包括多个选项卡、窗格、Unicode、和 UTF-8 字符支持,GPU 加速文本渲染引擎以及自定义主题、样式和配置。

本文将 .Net Core的PowerShellPowerShell 7 代替

参考:
.NET Framework PowerShell和 .NET Core PowerShell的区别: https://learn.microsoft.com/zh-cn/powershell/scripting/whats-new/differences-from-windows-powershell?view=powershell-7.3
Windows Terminal简介: https://apps.microsoft.com/store/detail/windows-terminal/9N0DX20HK701?hl=zh-cn&gl=cn

下载并安装 Windows Terminal(Windows 11直接跳过)

  1. Github下载
  2. 使用Windows 10自带的Microsoft Store也可以下载(建议)

下载并安装 PowerShell 7

  1. Github下载 (建议下载msi结尾的 Windows Installer 安装包文件,可以安装到其他盘,不用手动设置环境变量。并且可以选择添加到右键菜单。)
  2. 使用Windows 10自带的 Microsoft Store 也可以下载 (不用配置Windows Terminal)
    改变安装路径
    Windows 10 系统PowerShell美化 IDEA终端、VsCode终端以及Windows Terminal的PowerShell
    将PowerShell 7添加到右键菜单,选择如图所示的选项
    Windows 10 系统PowerShell美化 IDEA终端、VsCode终端以及Windows Terminal的PowerShell
    Windows 10 系统PowerShell美化 IDEA终端、VsCode终端以及Windows Terminal的PowerShell

问题

Windows Terminal和安装的PowerShell 7以管理员运行的时候会出现 Windows无法访问指定设备、路径、或文件,你可能没有适当的权限访问该项目。

解决

C:\Program Files目录中有个WindowsApps文件夹,该文件夹是隐藏的,需要开启查看隐藏文件及文件夹的功能,该文件夹是Windows Store下载程序的文件夹,更改文件夹权限 右键该文件夹的属性–>安全->高级–>更改–>高级–>立即查找–>选择自己电脑的用户名–>确定–>勾选替换子容器和对象的所有者–>确定,开启文件夹的继承权 右键该文件夹的属性–>安全–>高级–>启用继承

下载并安装 Oh-My-Posh

  1. Github下载
  2. PowerShell命令下载并安装
Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://ohmyposh.dev/install.ps1'))

参考:https://ohmyposh.dev/docs/installation/windows

下载并安装 oh-my-posh 需要的字体

  1. Nerd Fonts (建议下载DejaVuSansMono Nerd Fonts字体)
  2. PowerLine-Fonts

本文安装以下两个字体:
Windows 10 系统PowerShell美化 IDEA终端、VsCode终端以及Windows Terminal的PowerShell

安装字体直接双击打开点击安装

配置 Windows Terminal 使用 Powershell 7

Ctrl+, 快捷键直接打开设置
Windows 10 系统PowerShell美化 IDEA终端、VsCode终端以及Windows Terminal的PowerShell
PowerShell 图标链接

Windows 10 系统PowerShell美化 IDEA终端、VsCode终端以及Windows Terminal的PowerShell
点击保存

打卡 Windows Terminal --> 点击刚才配置的文件 --> 外观(在其他设置里,如果窗口小了,可以下滑鼠标滚轮,就可以看到了

设置主题:
Windows 10 系统PowerShell美化 IDEA终端、VsCode终端以及Windows Terminal的PowerShell
选择刚才安装的字体
Windows 10 系统PowerShell美化 IDEA终端、VsCode终端以及Windows Terminal的PowerShell
选择光标形状
Windows 10 系统PowerShell美化 IDEA终端、VsCode终端以及Windows Terminal的PowerShell
设置背景图像(根据自己的爱好选择
Windows 10 系统PowerShell美化 IDEA终端、VsCode终端以及Windows Terminal的PowerShell
点击保存,就配置好了

配置oh-my-posh

PowerShell中输入

oh-my-posh init pwsh --config "$env:USERPROFILE\AppData\Local\Programs\oh-my-posh\themes\1_shell.omp.json" | Invoke-Expression

oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\1_shell.omp.json" | Invoke-Expression

oh-my-posh自带的主题在:C:\Users\UserName\AppData\Local\Programs\oh-my-posh\themes\

官网显示的主题样式和对应的主题名:https://ohmyposh.dev/docs/themes
使用 Get-PoshThemes Powershell命令也可以查看对应的主题样式和主题名

配置PowerShell 7环境变量

if(!(Test-Path -Path $PROFILE)){ New-Item -ItemType file -Path $PROFILE -Force} & notepad $PROFILE

Windows 10 系统PowerShell美化 IDEA终端、VsCode终端以及Windows Terminal的PowerShell
最后在记事本中输入以下PowerShell命令

选择自己喜欢的主题,替换下面的主题名

oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\主题名.omp.json" | Invoke-Expression

然后输入以下PowerShell命令,使配置文件立即生效

. $PROFILE

保存退出

展示
Windows 10 系统PowerShell美化 IDEA终端、VsCode终端以及Windows Terminal的PowerShell

配置 PowerShell 7

WIN+R 输入pwsh进入PowerShell 7–>鼠标左键点击左上角的PowerShell图标–>点击属性–>字体选择安装好的Windows 10 系统PowerShell美化 IDEA终端、VsCode终端以及Windows Terminal的PowerShell
–>颜色不透明度设置为90%(根据自己的喜好设置)
Windows 10 系统PowerShell美化 IDEA终端、VsCode终端以及Windows Terminal的PowerShell
展示
Windows 10 系统PowerShell美化 IDEA终端、VsCode终端以及Windows Terminal的PowerShell

配置并美化IDEA的 PowerShell 7

  1. 配置IDEA使用PowerShell 7
    文件(File)–>设置(Settings)–>工具(Tools)–>终端(Terminal)
    选择自己安装的PowerShell 7
    Microsoft Store安装的在 C:\Users\windy\AppData\Local\Microsoft\WindowsApps\pwsh.exe
    Github下载安装的在安装时你自己选择的目录
    Windows 10 系统PowerShell美化 IDEA终端、VsCode终端以及Windows Terminal的PowerShell
  2. 配置IDEA的PowerShell 7终端字体
    Ctrl+Alt+S 快捷键打开IDEA设置(Settings)–>编辑器(Editor)–>配色方案(Color Scheme)–>控制台字体(Console Font)–>选择使用控制台字体,而不是默认(Use console font instead of the default)–>选择安装好的字体
    Windows 10 系统PowerShell美化 IDEA终端、VsCode终端以及Windows Terminal的PowerShell
    展示
    Windows 10 系统PowerShell美化 IDEA终端、VsCode终端以及Windows Terminal的PowerShell

配置并美化VsCode的PowerShell 7

  1. 配置 VsCode 的默认终端
    文件(File)–>首选项(Preferences)–>设置(Settings)–>搜索(Search settings) Profile: Window -->点击在Settings.json中编辑(Edit in settings.json)
    Windows 10 系统PowerShell美化 IDEA终端、VsCode终端以及Windows Terminal的PowerShell
    Windows 10 系统PowerShell美化 IDEA终端、VsCode终端以及Windows Terminal的PowerShell
    复制以下json代码并覆盖图中选中的json代码
"terminal.integrated.profiles.windows": {
    "PowerShell 7": {
        "path": [
        	// 安装PowerShell 7的路径,粘贴到json文件之后,要删除这行
            "D:\\powershell\\7\\pwsh.exe"
        ],
        "args": [
            "-NoLogo"
        ]
    }
},
"terminal.integrated.defaultProfile.windows": "PowerShell 7",

Ctrl+S 保存settings.json

参考:https://code.visualstudio.com/docs/terminal/profiles文章来源地址https://www.toymoban.com/news/detail-464868.html

  1. 配置 VsCode 的 PowerShell 7 终端字体
    Windows设置(WIN+I)–>个性化–>字体–>搜索字体名
    Windows 10 系统PowerShell美化 IDEA终端、VsCode终端以及Windows Terminal的PowerShell
    VsCode设置中搜索 Editor: Font Family
    在其余的字体后加上查看的字体名,字体直接用英文逗号分隔。 注意:字体之间有空格的名称,要在字体名的两边加上英文单引号!
    Windows 10 系统PowerShell美化 IDEA终端、VsCode终端以及Windows Terminal的PowerShell
    展示
    Windows 10 系统PowerShell美化 IDEA终端、VsCode终端以及Windows Terminal的PowerShell

到了这里,关于Windows 10 系统PowerShell美化 IDEA终端、VsCode终端以及Windows Terminal的PowerShell的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • VScode替换cmd powershell为git bash 终端,并设置为默认

    1. 解决VScode缺少git bash的问题_failed to start bash - is git-bash.exe on the syst_Rudon滨海渔村的博客-CSDN博客 效果解决步骤找到git安装目录下的/bin/bash.exe,复制其绝对路径,例如D:Program FilesGitbinbash.exe把路径的右斜杠转义,例如D:\\\\Program Files\\\\Git\\\\bin\\\\bash.exe其实就是一个斜杠变两个在

    2024年02月12日
    浏览(24)
  • Windows PowerShell:连接Linux终端小助手

    在研究Quark-n的时候,利用Windows自带的远程桌面连接,实现了在Windows上看到Linux的GUI,但是很快就发现了好多问题,比如想用Tab补全命令的时候,它不灵,只能Shitf+Tab,有悖于传统操作按键,而且GUI有延时,拖动终端时有拖影,图形操作体验很差。为了解决这个问题,便在网上

    2024年02月11日
    浏览(29)
  • Powershell / windows终端 无法加载文件 因为在此系统上禁止运行脚本。有关详细信息,请参阅 https:/go.microsoft.com/fwlink/?LinkID=135170

    在 powershell 或者 windows 终端中运行脚本文件时,提示“无法加载文件 因为在此系统上禁止运行脚本。有关详细信息,请参阅 https:/go.m icrosoft.com/fwlink/?LinkID=135170 中的 about_Execution_Policies。” PowerShell 或者 windows 终端启动时,为了确保安全,文件的执行策略默认设置为 Restric

    2024年02月01日
    浏览(28)
  • 终端(命令提示符或Windows PowerShell或Azure Cloud Shell)概述

    终端(命令提示符或Windows PowerShell或Azure Cloud Shell)是一种很 不 好用的东西 就是要背,很 不 爽 Windows 终端是一个新式主机应用程序,它面向你喜爱的命令行 shell,如命令提示符、PowerShell 和 bash(通过适用于 Linux 的 Windows 子系统 (WSL))。 它的主要功能包括多个选项卡、窗格

    2024年01月23日
    浏览(23)
  • windows10下powershell中如何在后台执行python程序

    在windows10本地执行时间较长的程序时,很容易忘记,随手关掉编译器,程序就此中断,造成精神伤害。 如果不管不挂起,不管日志重定向,我要运行的python脚本的命令很简单 现在挂起在后台,需要把原先在控制台显示的一大堆输出,重定向到日志文件中。注意,在win10下不可

    2024年03月09日
    浏览(20)
  • PowerShell 美化(oh-my-posh)

    1、 修改默认右键菜单 直接使用这个命令可以将 win11 的右键菜单修改为 win10 的右键菜单: 如果要回复成 win11 默认右键菜单的话: 2、 寻找安装目录 比如说我的安装目录: 3、 修改注册表 将这个路径复制下来,打开注册表: win+r - regedit 在注册表中进入路径: 新建一个项:

    2024年02月10日
    浏览(38)
  • windows10系统下安装opencv4.7.0+VSCode+(C++)环境搭建

    windows10系统下安装opencv4.7.0+VSCode+(C++)环境搭建 1.VScode最新版 2.Opencv:opencv-4.7.0、opencv_contrib-4.7.0(扩展库,可自选是否安装) 3.MinGW-w64:选择GCCWindows版本 4.c-make工具:最新版,应选择二进制版本 注意 : (1)以上安装包目录文件中不应包含空格空格和其他非法字符,否则后面会

    2023年04月10日
    浏览(26)
  • 电脑新装系统优化,win10优化,win10美化

    公司发了新的笔记本,分为几步做 1.系统优化,碍眼的关掉。防火墙关掉、页面美化 2.安装必备软件及驱动 3.数据迁移 4.开发环境配置 目录复制 关掉底部菜单栏花里胡哨 消息通知优化 关闭粘贴键 开始菜单优化 开机启动优化 关闭通知 关闭win安全 关闭动画 开始菜单磁条优化

    2024年02月15日
    浏览(38)
  • 【问题解决】VSCode终端中没有Git-Bash以及将其设置为默认终端

    1.找到你 git bin bash.exe 的安装路径 2.在终端里点击小箭头 3. 选择配置终端设置 4.找到terminal.integrated.profiles.windows,进入json编辑 5.在配置文件中添加 6.重启VSCode

    2024年02月09日
    浏览(24)
  • VScode 终端无法识别npm以及Missing script: “serve“ 问题

    原因是没有全局安装npm npm list --depth=0 -global npm install -g npm     原因是package.json中没有配置:\\\"serve\\\": \\\"vite serve\\\" \\\"serve\\\": \\\"vite serve\\\"

    2024年02月16日
    浏览(31)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包