powershell自定义命令颜色

少年是不是觉得这样的 命令行 看的不甚清晰
在这里插入图片描述
高亮显示所有所有命令
在这里插入图片描述
一键换色你值得拥有
在这里插入图片描述

Prerequisites (Windows only)

Before you’re able to run PowerShell scripts on your machine, you need to set your local ExecutionPolicy to RemoteSigned (Basically anything except Undefined and Restricted). If you choose AllSigned instead of RemoteSigned, also local scripts (your own) need to be digitally signed in order to be executed. With RemoteSigned, only Scripts having the “ZoneIdentifier” set to Internet (were downloaded from the web) need to be signed, others not. If you’re an administrator and want to set it for all Users on that machine, use “-Scope LocalMachine”. If you’re a normal user, without administrative rights, you can use “-Scope CurrentUser” to set it only for you.

> Set-ExecutionPolicy -Scope LocalMachine -ExecutionPolicy RemoteSigned -Force

Set Color

  1. 打开powershell
  2. 运行命令
Set-PSReadLineOption -Colors @{
  Command            = 'Magenta'
  Number             = 'Green'
  Member             = 'Green'
  Operator           = 'Yellow'
  Type               = 'Green'
  Variable           = 'Yellow'
  Parameter          = 'Yellow'
  ContinuationPrompt = 'Green'
  Default            = 'Green'
}
  1. 打开 文件C:\Users\<username>\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1,将上述命令写入文件并保存
  2. 另附微软官方powershell配置文档一份
  • 5
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值