Reputation: 69114
In powershell this variable is the path to the profile: $Profile
On my system it equals:
C:\Users\Warren\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
I would like to get just the path part:
C:\Users\Warren\Documents\WindowsPowerShell\
In C# you would call Path.GetDirectoryName
, so I guess I can call [system.io.Path]::GetDirectoryName($fileName)
but I'm wondering if there's a builtin path manipulation system I should know about in PowerShell?
Is this what people do?
[system.io.Path]::GetDirectoryName($Profile)
Upvotes: 1
Views: 187