1
在PowerShell中這個變量是路徑輪廓:它等於$Profile
如何從Powershell中包含完全限定文件名的變量中獲取目錄名稱?
在我的系統:
C:\Users\Warren\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
我希望得到公正的路徑部分:
C:\Users\Warren\Documents\WindowsPowerShell\
在C#你會打電話給Path.GetDirectoryName
,所以我想我可以打電話[system.io.Path]::GetDirectoryName($fileName)
,但我想知道是否有一個內建的路徑操作系統,我應該知道在PowerShell中?
這是人們在做什麼?
[system.io.Path]::GetDirectoryName($Profile)
'-Parent'可以在這種情況下可以省略。 –
正確的我只是想顯示完整的語法,-parent是默認行爲 –