【发布时间】:2013-10-04 12:20:16
【问题描述】:
如何获取当前正在执行的命令或脚本的当前路径?
尝试了以下脚本:
$scriptpath = $MyInvocation.MyCommand.Path
write-host $scriptpath
这样称呼它:
invoke-command -computername localhost -filepath .\test.ps1
还尝试了以下方法,但得到一个空行:
invoke-command -scriptblock { write-host $MyInvocation.MyCommand.Path }
【问题讨论】:
标签: powershell