> For the complete documentation index, see [llms.txt](https://poshcode.gitbook.io/powershell-faq/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://poshcode.gitbook.io/powershell-faq/src/getting-started/script-root.md).

# How do I determine the location of the current PowerShell script?

Ever since PowerShell 3, there is an automatic variable `$PSScriptRoot` which is set to the path of the directory that contains the currently-executing module or script. Additionally, there is `$PSCommandPath` which contains the path (including the file name) to the currently executing script.
