Aliases, functions and key bindings you set in PowerShell vanish when the window closes. They last when you put them in your profile, and $PROFILE knows where that file lives.
PowerShell doesn’t create the file for you. This makes it only if it is missing, so it never overwrites one you already have:
if (!(Test-Path -Path $PROFILE)) {
New-Item -ItemType File -Path $PROFILE -Force
}
notepad $PROFILE
Add whatever you want in every session, for example:
Set-Alias -Name ll -Value Get-ChildItem
function repo { Set-Location $HOME\src }
Save, then open a new PowerShell window to load it.
$PROFILE on its own points at the profile for the current user in the current host. There are four in total, and this shows all their paths:
$PROFILE | Select-Object *
Shared things belong in $PROFILE.CurrentUserAllHosts, in my view, so the same aliases also load in the VS Code terminal, which has a host profile of its own.
If nothing happens at startup, look at the execution policy. Under Restricted, the default on Windows client machines, no scripts run, profiles included. Also note that Windows PowerShell 5.1 and PowerShell 7 use different folders, so a profile made in one is not read by the other. And pwsh -NoProfile starts a clean session when your profile itself is the problem.
Further reading: about_Profiles (Microsoft Learn)