Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where does Windows PowerShell set $profile?

Tags:

powershell

I would like to move my default "My Documents\WindowsPowerShell" folder. However, when I try this, PowerShell of course can't find $profile. Is there a file or something that I can edit to point PowerShell to a different startup folder?

like image 719
Charles Anderson Avatar asked Oct 01 '11 17:10

Charles Anderson


3 Answers

What I can suggest is that you dot source the file having the content of your profile in the file $profile.AllUsersAllHosts

$profile.AllUsersAllHosts is something like C:\Windows\System32\WindowsPowerShell\v1.0\profile.ps1

Related question: Is it possible to change the default value of $profile to a new value?

like image 94
manojlds Avatar answered Sep 28 '22 11:09

manojlds


You could use junction.exe from Sysinternals to make the WindowsPowershell directory a symbolic link to another location (but not a network drive).

You could do this if you wanted to store the profile scripts at C:\POSH

junction.exe "$HOME\Documents\WindowsPowerShell" 'C:\POSH'
like image 33
Rynant Avatar answered Sep 28 '22 11:09

Rynant


As far as i know you can't do that. The user profile location is always under 'My Documents\WindowsPowerShell' and your only option is to relocate your documents folder (folder redirection).

like image 43
Shay Levy Avatar answered Sep 28 '22 11:09

Shay Levy