LoginSignup
8
5

More than 5 years have passed since last update.

PowerShellメモ Write-Host色一覧

Last updated at Posted at 2017-01-10

概要

Write-Hostコマンドレットで指定できる色の一覧。

色一覧

名称 名称
White 16.png Black 01.png
Blue 10.png DarkBlue 02.png
Green 11.png DarkGreen 03.png
Cyan 12.png DarkCyan 04.png
Red 13.png DarkRed 05.png
Magenta 14.png DarkMagenta 06.png
Yellow 15.png DarkYellow 07.png
Gray 08.png DarkGray 09.png

使用例

ps33.png

注意点

DarkMagentaとDarkYellowは環境によっては意図しない色で表示される。
ps34.png
使用例のようにコマンドプロンプトからPowerShellを起動すると正しく表示される。

DarkMagentaとDarkYellowの色設定がコマンドプロンプトからPowerShellになって変わっているのが原因。
(仕様だそうです。参考サイト、コメント参照)
左から順にBlack, DarkBlue, DarkGreen, DarkCyan, DarkRed, DarkMagenta, DarkYellow, Gray, DarkGray, Blue, Green, Cyan, Red, Magenta, Yellow, Whiteに対応している。
ps35.png

ps36.png

PowerShell ISEの方は問題なし。
ps37.png

動作確認した環境

  • PowerShell V4 (Windows 8.1)
  • PowerShell V5 (Windows 10)

参考サイト

8
5
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
5