PowerShell で .bashrc 的なことがしたい

PowerShell にも .bashrc 的なファイルがあって、それを編集すればシェルを起動するときに任意の設定を読み込める。

$profile 変数にプロファイルファイルのパスが入っているので、これを編集する。なお、存在しない場合があるので、その場合は $profile のパスにファイルを作成する。

# 存在確認
Test-Path $profile

# なければ作る
New-Item -path $profile -type file -force

# 編集
code $profile

参考