PowerShell opens in C:\Windows\System32, but I want it to start in my user directory instead. How can I set that without running cd every time?
How can I make PowerShell start in my home directory?
Answers
Add Set-Location $HOME to your PowerShell profile. That command runs when the profile loads and moves the session to your user directory.
To create the profile file if it doesn't exist, run New-Item -ItemType File -Path $PROFILE -Force. Then run notepad $PROFILE, add Set-Location $HOME on its own line, and save the file. Open a new PowerShell session to check it.
If you already have a profile, skip the New-Item command and just edit it. Profile scripts can be affected by the execution policy, so an error about scripts being disabled may need attention before this works.
Reply to this answer
First, check how you're launching it. An elevated PowerShell session can start in System32, while a regular session may start in your home directory. That isn't the only possible cause, though, so seeing System32 doesn't prove it's running as administrator.
Reply to this answer
Add your answer
Answers are reviewed before publication.
Q8.rivermark:
$PROFILE points to the profile for the current PowerShell host, so check the path if you use more than one way to launch PowerShell.