0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

PowerShell 5.1からPowerShell 7 (7.5.3)に移行するガイド

Posted at

既にwingetとWindows Terminalを利用している想定

PowerShell 7をインストールする

~$ winget search Microsoft.PowerShell
Name               Id                           Version Source
---------------------------------------------------------------
PowerShell         Microsoft.PowerShell         7.5.3.0 winget
PowerShell Preview Microsoft.PowerShell.Preview 7.6.0.5 winget
~$ winget install Microsoft.PowerShell

Windows Terminalの呼び出しパスを変更する

  1. Windows Terminalを開く
  2. Ctrl+,で設定を開く
  3. Profile → Windows PowerShellの順に開く
  4. Command lineのパスを変更する
    • 変更前: %SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe
    • 変更後: %ProgramFiles%\PowerShell\7\pwsh.exe

プロファイルを移行する

移行先を確認する。

~$ $PROFILE | Select-Object *Host* | Format-List

AllUsersAllHosts       : C:\Program Files\PowerShell\7\profile.ps1
AllUsersCurrentHost    : C:\Program Files\PowerShell\7\Microsoft.PowerShell_profile.ps1
CurrentUserAllHosts    : C:\Users\[ユーザー名]\Documents\PowerShell\profile.ps1
CurrentUserCurrentHost : C:\Users\[ユーザー名]\Documents\PowerShell\Microsoft.PowerShell_profile.ps1

%UserProfile%\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
にプロファイルがあったので、
%UserProfile%\Documents\PowerShell\Microsoft.PowerShell_profile.ps1
に移動した。特に書き換えずそのまま。

さいごに

関係あるかわからないけど、読み込みが速くなった。
2400ms→1700ms以下に

参考リンク

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?