PowerTip: Find Current Directory in PowerShell


Summary: Easily find the current directory in Windows PowerShell. 

Hey, Scripting Guy! Question How can I return a path object that contains information about the current working directory in Windows PowerShell?

Hey, Scripting Guy! Answer Use the $pwd automatic variable:

PS C:\> $pwd

Comments (2)

  1. AllanM says:

    Also: convert-path .

  2. Peter says:

    Or use: $ScriptDir = Split-Path $MyInvocation.MyCommand.Path

Skip to main content