# encoding: ascii
# api: powershell
# title: Get-ScriptDirectory
# description: Returns the directory that current script is running in.
# version: 0.1
# type: function
# author: Andy Arismendi
# license: CC0
# function: Get-ScriptDirectory
# x-poshcode-id: 2887
# x-archived: 2015-05-08T16:51:32
# x-published: 2012-08-03T09:02:00
#
#
function Get-ScriptDirectory {
$invocation = (Get-Variable MyInvocation -Scope 1).Value
$script = [IO.FileInfo] $invocation.MyCommand.Path
if ([IO.File]::Exists($script)) {
Return (Split-Path $script.Fullname)
} else {
return $null
}
}