1. 程式人生 > >Powershell獲取當前路徑

Powershell獲取當前路徑

獲取當前路徑,之前一直通過內建的$MyInvocation變數:

$CurrentyDir=Split-Path-Parent$MyInvocation.MyCommand.Definition;

PowerShell3.0之後,直接一個$PSScriptRoot解決問題