Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing Powershell 7.2 default working directory

Tags:

powershell

I have just installed the new Powershell 7.2 release from the Windows store on my Windows 10 computer. When I run the application, the default starting path is C:\Windows\System32.

How can I change this default to to a C:\Users\<username> path, since I would like to avoid having to cd or Set-Location every time I use Powershell.

I looked at some other questions related to this topic, but wasn't sure if it still applies to the new release and didn't want to change anything that might mess up my settings and cause problems.

like image 345
Jub Avatar asked Aug 09 '26 21:08

Jub


1 Answers

Steps validated in Powershell 5.1 environment:

  1. Check your profile file location. Mine is:
PS C:\Users\alex> $PROFILE

C:\Users\alex\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
  1. Modify your profile Microsoft.PowerShell_profile.ps1 Change starting location to the directory you want:
Set-Location C:\Users\alex
  1. Start new Powershell window

Hope this works for you.

like image 103
Alex Korobchevsky Avatar answered Aug 12 '26 22:08

Alex Korobchevsky



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!