Powershell: resolve path that might not exist?

前端 未结 13 2485
再見小時候
再見小時候 2020-12-02 13:05

I\'m trying to process a list of files that may or may not be up to date and may or may not yet exist. In doing so, I need to resolve the full path of an item, even though

13条回答
  •  生来不讨喜
    2020-12-02 13:43

    I had a similar issue where I needed to find the folder 3 levels up from a folder that does not exist yet to determine the name for a new folder I wanted to create... It's complicated. Anyway, this is what I ended up doing:

    ($path -split "\\" | select -SkipLast 3) -join "\\"
    

提交回复
热议问题