Understanding your location - ($pwd / Get-Location) 

$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

PowerShell ISE / CLI 

For the PowerShell ISE or PowerShell CLI the $pwd is set by the shortcut properties “Start in:”. “%HOMEDRIVE%%HOMEPATH%”

Working with the $pwd within the Script 

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.

Setting $PWD in the $Profile 

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

# Uses PowerShell ISE to edit the profile
psedit $profile.CurrentUserCurrentHost

Additional Reading 

Using Profiles in the PowerShell_ISE