$pwd is an automatic variable which contains PowerShell’s current location. $pwd, which stands for “print working directory”, and functions like the PowerShell command “Get-Location”.
You may see me refer to $pwd as “Present Working Directory” because it also fits the abbreviation and it was always easier for me to remember its function.
VSCode sets the $pwd (“present working directory”) to the current Workspace location
For the PowerShell ISE or PowerShell CLI the $pwd is set by the shortcut properties “Start in:”. “%HOMEDRIVE%%HOMEPATH%”
Just because you have the working directory set when you write the code, does not mean that the working directory will be the same when you execute the code.
Or you can edit your profile to include a “*Set-Location*” command put in a side note here about the different profiles, and what they do