Where does Windows PowerShell set $ profile?

I would like to move the default folder "My Documents \ WindowsPowerShell". However, when I try to do this, PowerShell, of course, cannot find the $ profile. Is there a file or something that I can change to point PowerShell to another startup folder?

+7
source share
4 answers

What I can offer is that you transfer the source containing the content of your profile to the $profile.AllUsersAllHosts file

$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?

+7
source

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

This can be done if you want to save profile scripts in C:\POSH

 junction.exe "$HOME\Documents\WindowsPowerShell" 'C:\POSH' 
+2
source

As far as I know, you cannot do this. The user profile location is always in the "My Documents \ WindowsPowerShell" section, and your only option is to move the document folder (folder redirection).

+1
source

By default, $Profile/$Home/$PSModulePath are in the registry ... usually under

  • HKEY_CURRENT_USER\Volatile Environment for user environment variables
  • HKEY_CURRENT_USER\Environment for system environment variables
  • HKEY_CURRENT_USER\Software\Microsoft\Windows\Explorer\User Shell Folders

and in another place!

0
source

All Articles