Path of currently executing powershell script

Viewed 126491

How do I do this in PowerShell. In a batch file I would do: %~d0%~p0

4 Answers

From Get-ScriptDirectory to the Rescue blog entry ...

function Get-ScriptDirectory
{
  $Invocation = (Get-Variable MyInvocation -Scope 1).Value
  Split-Path $Invocation.MyCommand.Path
}
Related