首先我是参考微软的word的, look~

Windows PowerShell 配置文件

要配置powershell很简单, 就几步

1.显示 Windows PowerShell 配置文件的路径

$profile

2.确定是否已经在系统上创建了 Windows PowerShell 配置文件,请键入:

test-path $profile

如果存在配置文件,则响应为 True:否则响应为 False。(我的显示是False)

3.创建 Windows PowerShell 配置文件,请键入:

new-item -path $profile -itemtype file -force

4.在记事本中打开配置文件,请键入:

notepad $profile

然后把下面的配置方案扔进去

set-alias ll         Get-ChildItemColor

function prompt
{
$my_path = $(get-location).toString()
$my_pos = ($my_path).LastIndexOf("\") + 1
if( $my_pos -eq ($my_path).Length ) { $my_path_tail = $my_path }
else { $my_path_tail = ($my_path).SubString( $my_pos, ($my_path).Length - $my_pos ) }
Write-Host ("[") -nonewline -foregroundcolor 'Green'
Write-Host ("Chenglee") -nonewline -foregroundcolor 'Red'
Write-Host ("@") -nonewline -foregroundcolor 'Yellow'
Write-Host ("WIN7 ") -nonewline -foregroundcolor 'Magenta'
Write-Host ($my_path_tail) -nonewline -foregroundcolor 'Blue'
Write-Host ("]#") -nonewline -foregroundcolor 'Green'
return " "
} function Get-ChildItemColor {
<#
.Synopsis
Returns childitems with colors by type.
.Description
This function wraps Get-ChildItem and tries to output the results
color-coded by type:
Directories - Cyan
Compressed - Red
Executables - Green
Text Files - Gray
Image Files - Magenta
Others - Gray
.ReturnValue
All objects returned by Get-ChildItem are passed down the pipeline
unmodified.
.Notes
NAME: Get-ChildItemColor
AUTHOR: Tojo2000 <tojo2000@tojo2000.com>
#>
$regex_opts = ([System.Text.RegularExpressions.RegexOptions]::IgnoreCase -bor [System.Text.RegularExpressions.RegexOptions]::Compiled)
$fore = $Host.UI.RawUI.ForegroundColor
$compressed = New-Object System.Text.RegularExpressions.Regex(
'\.(zip|tar|gz|rar|7z|tgz|bz2)', $regex_opts)
$executable = New-Object System.Text.RegularExpressions.Regex(
'\.(exe|bat|cmd|py|pl|ps1|psm1|vbs|rb|reg|sh)', $regex_opts)
$text_files = New-Object System.Text.RegularExpressions.Regex(
'\.(txt|cfg|conf|ini|csv|log)', $regex_opts)
$image_files = New-Object System.Text.RegularExpressions.Regex(
'\.(bmp|jpg|png|gif|jpeg)', $regex_opts) Invoke-Expression ("Get-ChildItem $args") |
%{
if ($_.GetType().Name -eq 'DirectoryInfo') { $Host.UI.RawUI.ForegroundColor = 'Cyan' }
elseif ($compressed.IsMatch($_.Name)) { $Host.UI.RawUI.ForegroundColor = 'Red' }
elseif ($executable.IsMatch($_.Name)) { $Host.UI.RawUI.ForegroundColor = 'Green' }
elseif ($text_files.IsMatch($_.Name)) { $Host.UI.RawUI.ForegroundColor = 'Gray' }
elseif ($image_files.IsMatch($_.Name)) { $Host.UI.RawUI.ForegroundColor = 'Magenta' }
else { $Host.UI.RawUI.ForegroundColor = 'Gray' }
echo $_
$Host.UI.RawUI.ForegroundColor = $fore
}
} function Show-Color( [System.ConsoleColor] $color )
{
$fore = $Host.UI.RawUI.ForegroundColor
$Host.UI.RawUI.ForegroundColor = $color
echo ($color).toString()
$Host.UI.RawUI.ForegroundColor = $fore
} function Show-AllColor
{
Show-Color('Black')
Show-Color('DarkBlue')
Show-Color('DarkGreen')
Show-Color('DarkCyan')
Show-Color('DarkRed')
Show-Color('DarkMagenta')
Show-Color('DarkYellow')
Show-Color('Gray')
Show-Color('DarkGray')
Show-Color('Blue')
Show-Color('Green')
Show-Color('Cyan')
Show-Color('Red')
Show-Color('Magenta')
Show-Color('Yellow')
Show-Color('White')
}

启动powershell(可能会报错, 不管它)执行下面命令:

Set-ExecutionPolicy RemoteSigned

选择Y

OK!

重新启动powershell!

以后要修改配置方案的话直接换C:\Users\hp\Documents\WindowsPowerShell目录下的Microsoft.PowerShell_profile.ps1文件即可。

win7 powershell配色方案的更多相关文章

  1. 解决提示“配色方案已更改为Windows7 Basic”

    WIN7是很多用户都用过的系统,是由微软推出的.下面就说一个小技巧. 如何解决Win7系统提示:“配色方案已更改为Windows 7 Basic”解决方案.   更改Win7配色方案 首先,右击桌面空 ...

  2. QT Creater 配色方案及下载

    打开QT Creater的工具--选项--文本编辑器--字体和颜色,复制一份配色方案:Vim (dark) ->Vim (dark) (copy) 更改想更改的任何内容的配色.其中,修改后的文件 ...

  3. 分享3个Putty配色方案【转】

    本文转载自:https://www.coder4.com/archives/1506 分享3个Putty配色方案 4 Replies 虽然服务器都是Linux的,平时也基本用Linux,但是难免还是要 ...

  4. CodeBlocks 配色方案设置

    最终效果(官方sublime修改版) 官方配色 codeblocks是一个功能很强大编程软件,我们在安装codeblocks后软件默认的是白底黑字界面,这种界面在长时间写代码时会对眼睛造成很大伤害,增 ...

  5. 改变linux默认配色方案(dircolors和dircolors-solarized使用)

    前言 前几天刚买了阿里云的云服务器,今天使用putty进入服务器,发现linux默认的bash配色实在太丑. 特别是文件夹显示为深蓝色,到了白天,和黑色背景一搭配,根本看不清文字. 好在在github ...

  6. VisualStudio配色方案

    最近发现一个很神奇的网站,可以方便的为VisualStudio配色:Studio Styles - Visual Studio color schemes 可以下载一份自己喜欢的配色方案 如果还不满意 ...

  7. 好看的IDE配色方案让代码看起来不再那么凶猛了

    写这篇小文的初衷是,笔者是原教旨主义者,一直坚持用IDE默认的配色方案.另外也觉得网上黑色系的配色方案太过bling bling了.但今天尝试用新的配色方案后,兴奋地发现对代码的好感度大幅提升. 嗯, ...

  8. Sourceinsight最佳配色方案及颜色字体调整方法

    在Ubuntu下面用Gedit有一款比较好看的配色,应该是Darkblue.按照那个样子在SI里面做了一个差不多的,按个人喜好,背景色换成黑色,如下所示: 配色的方案文件可以从此处链接免费下载: 配色 ...

  9. Visual Studio配色方案

    Eclipse开源工具和VS在诸多方面真的是差距非常大,无奈Java编程,使用VS非常麻烦.所以只能选择Eclipse 但是Eclipse的系统配色,又实在是不舒服,于是抽时间,从VS上抠了一份默认的 ...

随机推荐

  1. 线程中使用SaveFileDialog不能弹出窗体

    在子线程中使用 SaveFileDialog 无法弹出窗体,主要是我们需要用主线程去处理SaveFileDialog , 我们可以将子线程进行如下设置: public partial class Fo ...

  2. 安装python sklearn经验总结

    1. 需要安装 numpy, scipy, 和sklearn和ipython,Cython sklearn,ipython, Cython都可以通过pip来安装.但scipy,可能还有numpy必须通 ...

  3. XML反序列化遇到数字型节点值为空导致反序列化异常

    实体类: [XmlRoot("stream")] public class _30320DuisiFukuanQueryResponseModel : ResponseModelB ...

  4. iframe中父页面与子页面的传值方法

    涉及到iframe传值的情况有这么几种:(1)父页面给iframe中的子页面传值(2)子页面调用父页面中的函数(3)iframe中的子页面给父页面传值(4)兄弟iframe之间的传值 下面来逐一看一下 ...

  5. EF性能优化

    下面总结了一些在使用EF的过程中应当特别注意的地方,避免大家再走弯路. 1.分清真分页和假分页 大家都知道分页分为真分页和假分页,并且假分页是特别耗费性能的.我们在使用的过程中也是以真分页为主,但是在 ...

  6. armv8 memory system

    在armv8中,由于processor的预取,流水线, 以及多线程并行的执行方式,而且armv8-a中,使用的是一种weakly-ordered memory model, 不保证program or ...

  7. python ip代理

    import random import urllib.request from bs4 import BeautifulSoup import time url ='http://www.whati ...

  8. rpgmakermv(10) GraphicalDesignMode

    插件地址:https://github.com/triacontane/RPGMakerMV/blob/master/GraphicalDesignMode.js 原文: メニュー画面や戦闘画面など各 ...

  9. Lua用table模拟二维数组

    local array = {}; , , , , } , , , , } local row3 = {"I", "love", "lua" ...

  10. 【转】推荐4个不错的Python自动化测试框架

    之前,开发团队接手一个项目并开始开发时,除了项目模块的实际开发之外,他们不得不为这个项目构建一个自动化测试框架.一个测试框架应该具有最佳的测试用例.假设(assumptions).脚本和技术来运行每一 ...