PowerShell FAQ
  • Initial page
  • PowerShell Frequently Asked Questions
    • getting-started
      • How do I determine the location of the current PowerShell script?
      • How do I set the PATH in PowerShell?
      • How do I determine the current version of PowerShell?
      • How do I pass parameters to PowerShell scripts?
      • How do I fix "the execution of scripts is disabled on this system" errors?
    • learning-paths
      • Are there any free PowerShell ebooks?
      • Is there any free training for PowerShell
      • books-for-programmers
      • video-resources
      • books-for-newbies
    • frequently-asked-faq-questions
      • contributing
      • What's the license for this FAQ?
    • SUMMARY
    • justification
      • Why should I learn PowerShell?
Powered by GitBook
On this page

Was this helpful?

  1. PowerShell Frequently Asked Questions
  2. getting-started

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.

Previousgetting-startedNextHow do I set the PATH in PowerShell?

Last updated 4 years ago

Was this helpful?