C:\Windows\System32\WindowsPowerShell\v1.0 for the 64bit environment.You should consider both environments if you want to always execute the profile code.
Alias in spss code code#
If you really need to execute the profile code for every user, mind that the $PsHome path is different for 32bit and 64bit instances of PowerShell. This is safer because you don't pollute other users' space (usually, you don't want to do that).Īnother advantage is that you don't need administrator rights to add the file to your user-space (you do for anything in C:\Windows\System32). This means the user-specific commands will overwrite variables in case of duplicates or conflicts.Īlways put the code in the user-specific profile if there is no need to extend its execution to every user. If both paths contain a profile.ps1 file, the all-users one is executed first, then the user-specific one. IMPORTANT: remember you need to restart your PowerShell instances to apply the changes. $PsHome ( C:\Windows\System32\WindowsPowerShell\v1.0): every user will execute this code.You can quickly find your profile location by running echo $profile in PowerShell "$Home\Documents" (usually C:\Users\\Documents): only your user will execute the code.To answer your question, you only have to create a profile.ps1 file containing the code you want to be executed, that is: New-Alias Goto Set-Location We will consider only 2 of them: the "all users" and the "only your user" paths (follow the previous link for further options). There are at least 6 different paths where to store the code depending on which user has to execute it. It's possible to store in a profile.ps1 file any PowerShell code to be executed each time PowerShell starts.