Changing the Location of PowerShell Profile Scripts
- Applications
- Published Mar 14, 2026
A PowerShell profile is an init script that is executed when the shell starts. PowerShell searches for profile scripts in hard-coded locations. This article explains how to move profile scripts to any directory of your choice.

Where are Profile Scripts Located?
As documented here, PowerShell has per-machine in addition to per-user profile scripts. We’ll ignore the former and focus on the latter.
User Profile Scripts
Per-user PowerShell profile scripts are stored in the Windows user profile. The path and name depend on the PowerShell version as well as the PowerShell host (e.g., Windows Terminal, VS Code). Here’s a quick overview:
| PowerShell version | PowerShell host | Path | File name |
|---|---|---|---|
| Windows PowerShell (5.x) | all hosts | %USERPROFILE%\Documents\WindowsPowerShell | profile.ps1 |
| PowerShell (7.x) | all hosts | %USERPROFILE%\Documents\PowerShell | profile.ps1 |
| Windows PowerShell (5.x) | console host, Terminal | %USERPROFILE%\Documents\WindowsPowerShell | Microsoft.PowerShell_profile.ps1 |
| PowerShell (7.x) | console host, Terminal | %USERPROFILE%\Documents\PowerShell | Microsoft.PowerShell_profile.ps1 |
| Windows PowerShell (5.x) | VS Code | %USERPROFILE%\Documents\WindowsPowerShell | Microsoft.VSCode_profile.ps1 |
| PowerShell (7.x) | VS Code | %USERPROFILE%\Documents\PowerShell | Microsoft.VSCode_profile.ps1 |
Changing the Location of PowerShell Profile Scripts
The symlink technique I used for Windows Store apps like Windows Terminal doesn’t work well with PowerShell because it breaks dot-sourcing (including additional scripts from a path relative to the symlink target). We can use dot-sourcing as a simple alternative, though.
Source
Using the table above, determine the path and file name of the profile script whose location you want to change. For the PowerShell 7 all hosts script, for example, that would be:
%USERPROFILE%\Documents\PowerShell\profile.ps1
Create that as a new (empty) file and open it in an editor.
Target
In the above profile script, we place a single instruction to include the actual profile script from the target directory, e.g.:
. 'D:\Data\PowerShell\profile_v7.ps1'
That’s it! We effectively redirected from %USERPROFILE%\Documents\PowerShell\profile.ps1 to D:\Data\PowerShell\profile_v7.ps1.






Comments