0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【powershell】プロンプトで曜日感覚を取り戻す

Last updated at Posted at 2020-05-02

在宅勤務が続いて曜日感覚がなくなってきたので、プロンプトで曜日感覚を取り戻そうと思います。

サンプル

色だけ変えるとこんな感じになります。
20200522113432.png
20200522113448.png
20200522113504.png
20200522113522.png

prompt

Microsoft.PowerShell_profile.ps1
function prompt {
    $table = @(
        @("日", "DarkYellow", "White"),
        @("月", "DarkBlue",   "White"),
        @("火", "Magenta",    "Gray"),
        @("水", "DarkCyan",   "White"),
        @("木", "Green",      "White"),
        @("金", "Yellow",     "DarkGray"),
        @("土", "Cyan",       "White")
    )
    $today = $table[[System.Convert]::toint32((Get-Date).DayOfWeek)]
    $leaf = $pwd.Path | Split-Path -Leaf
    Write-Host ("{0}[{1}]" -f (Get-Date -Format "yyyy-MM-dd"), $today[0]) -NoNewline -BackgroundColor $today[1] -ForegroundColor $today[2]
    Write-Host "~\$leaf" -ForegroundColor $today[1] -BackgroundColor $today[2]
    Write-Host ">" -NoNewline
    return " "
}
0
2
0

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
0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?