簡體   English   中英

在二進制Powershell模塊中獲取工作目錄

[英]Get working directory in binary powershell module

我正在用C#編寫二進制Powershell模塊,但似乎找不到從命令中獲取當前工作目錄的方法。

我首先想到的是做一個簡單的Directory.GetCurrentDirectory(); System.IO庫中獲取,但似乎只給了我啟動powershell的目錄。

在執行命令期間,如何在二進制Powershell模塊中獲取當前目錄?

謝謝

假設您的cmdlet使用CurrentProviderLocation("FileSystem").ProviderPath從PSCmdlet派生。ProviderPath應該可以很好地完成此工作(未經測試)。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM