PowerShell $profile and mklink

I have an issue with PowerShell as I have VS Code on my Windows machine. When I’m using a regular PowerShell console, it uses one profile and when I’m on VS Code’s PowerShell console in Terminal, it uses different profile. I don’t want to have to manage both. I want to be able to consolidate to one.

When you are in regular PowerShell console, if you type $profile and hit enter, you will get a path like the following.

C:\Users\amaterasu48\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1

When you do the same in VS Code’s PowerShell terminal, you get something like this.

C:\Users\amaterasu48\Documents\WindowsPowerShell\Microsoft.VSCode_profile.ps1

Microsoft.PowerShell_profile.ps1 but Microsoft.VSCode_profile.ps1 does not exist. So I thought I would create a symlink. Here what you can do. cd into the directory first and execute the following command as an administartor.

 mklink Microsoft.VSCode_profile.ps1 Microsoft.PowerShell_profile.ps1

It creates a symlink like the image below.

This way, both regular PowerShell console and VS Code PowerShell console share the same profile.

I read somewhere that you could change the value of $profile but I choose to just create a symlink. That may be another option to consolidate the two or more PowerShell profile files into one.

Author: admin

A software engineer in greater Seattle area

Leave a Reply

Your email address will not be published. Required fields are marked *