Get the current directory where PowerShell script is being executed

There are several ways you can get the current directory where your PowerShell script or cmdlets are being executed. You can get this information using (Get-Location).path or ($pwd).path or for the latest PowerShell version using the $PSScriptRoot environment variable. Below is one example for your reference –

Leave a Reply