PowerShellを快適にする


はじめに

PowerShell で.bash_profile のようなものを作成したい。

スクリプトに実行権限を与える

管理者で実行してください

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned

以下のエラーが出たら、

. : このシステムではスクリプトの実行が無効になっているためファイル C:\Users\user\Documents\WindowsPowerShell\Microso
ft.PowerShell_profile.ps1 を読み込むことができません詳細については、「about_Execution_Policies(https://go.microsoft
.com/fwlink/?LinkID=135170) を参照してください

上記のエラーが出たら、管理者で再度実行してください

プロファイルのパスを確認する

$profile

posh-git インストール

Install-Module posh-git -Scope CurrentUser

プロファイルを編集する

code $profile

中身を以下のように記述する

Set-PSReadLineKeyHandler -Key Tab -Function MenuComplete
Import-Module posh-git