DEV Community

tackme
tackme

Posted on

1

PowerShellでホームディレクトリを変更する

PowerShellの初期読み込みファイル(ii $PROFILEで開けます)に以下を追記するとホームディレクトリを変更できます。

# $HOMEの変更
Remove-Variable -Force HOME
Set-Variable HOME $env:HOME

# '~'の解決先を変更
$fs = $ExecutionContext.SessionState.Provider.Get("FileSystem")
$fs[0].Home = $env:HOME
Enter fullscreen mode Exit fullscreen mode

これで$HOMEの値やcd ~の移動先が設定したディレクトリに変更されます。

Top comments (0)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay