Akki
Akki

Reputation: 171

Split-path powershell

This must be very simple but yea I want to split-path "E:\Somefolder\ps\pow.ps1"

So by using

 Split-path "Path" -Parent

I get the parent path i.e."E:\Somefolder\ps" but I only want "E:\Somefolder" Any suggestions?

Upvotes: 1

Views: 761

Answers (1)

Akki
Akki

Reputation: 171

well! well! I was able to do it using following line:

 Split-Path (Split-path $MyInvocation.InvocationName -Parent)

Upvotes: 1

Related Questions