Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Powershell 如何从模块本身获取二进制模块在磁盘上的位置?_Powershell - Fatal编程技术网

Powershell 如何从模块本身获取二进制模块在磁盘上的位置?

Powershell 如何从模块本身获取二进制模块在磁盘上的位置?,powershell,Powershell,我正在开发的二进制PowerShell模块需要知道它在安装它的机器上的磁盘上的物理位置 是否可以从Cmdlet类获取它?如果是,任何.NET程序集(PowerShell二进制模块是.NET程序集)的属性如何包含此信息。在C#中: 在脚本模块中,$PSScriptRoot也是当前脚本的位置;在V3中,这似乎是在任何脚本中设置的 var myPath = Assembly.GetExecutingAssembly().CodeBase;

我正在开发的二进制PowerShell模块需要知道它在安装它的机器上的磁盘上的物理位置

是否可以从
Cmdlet
类获取它?如果是,任何.NET程序集(PowerShell二进制模块是.NET程序集)的属性如何包含此信息。在C#中:

在脚本模块中,
$PSScriptRoot
也是当前脚本的位置;在V3中,这似乎是在任何脚本中设置的

var myPath = Assembly.GetExecutingAssembly().CodeBase;