PowerShellのスタートアップファイル群
現状は次のようになっている。
- try $PROFILE
- C:\Users\hiyama\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
- try $env:HOME\.profile.ps1
- try $env:HOME\configs\powershell\.profile.ps1
- C:\Users\hiyama\Work\configs\powershell\.profile.ps1
- try ${DOTFILES}\.profile.common.ps1
- try ${DOTFILES}\.profile.g.$group.ps1
- try ${DOTFILES}\.profile.h.$THIS_HOST.ps1
- C:\Users\hiyama\Work\configs\powershell\.profile.common.ps1
- try $DOTFILES/functions/common.dsrc.ps1
- C:\Users\hiyama\Work\configs\powershell/functions/common.dsrc.ps1
- C:\Users\hiyama\Work\configs\powershell\.profile.g.desktop.ps1
変更予定
- $PROFILE
- try ${PS_CONFIG_DIR}\.profile.ps1
- ${PS_CONFIG_DIR}\.profile.ps1
- try ${PS_CONFIG_DIR}\.profile.common.ps1
- try ${PS_CONFIG_DIR}\.profile.g.$GROUP.ps1
- try ${PS_CONFIG_DIR}\.profile.h.$THIS_HOST.ps1
この後で、関数を定義したユニット(非公式モジュール)を読み込む。${PS_CONFIG_DIR}/scripts/ とかの下にあるフィルを列挙してソート順に全部読みこむでいいと思う。読み込みは、${PS_CONFIG_DIR}\.profile.ps1 で
行えばいいか。
次で出来るだろう。
ls ${SCRIPTS_DIR}\*.ps1 | %{$_.fullname} | %{ . $_ }