Catalog Version
get-item is your friendly help here.
(get-item $scriptPath ).parent.parent
If you only want a string
(get-item $scriptPath ).parent.parent.FullName
File version
If $scriptPath points to a file, you must first call the Directory property, so the call will look like this:
(get-item $scriptPath).Directory.Parent.Parent.FullName
Notes
This will only work if $scriptPath . Otherwise, you must use the Split-Path cmdlet.
rerun Mar 15 '12 at 18:13 2012-03-15 18:13
source share