allow function:cd to accept a file

Topics: Developer Forum, User Forum
Jul 6, 2007 at 4:29 PM
One thing I notice myself doing a lot is wanting to go to the directory that contains a given file, and I already have the full path to the file in front of me, so it’s easy to double-click and copy that path. I’d rather not have to click and drag to select just the dir part.

So, I want my cd alias to check if I gave it a file, and if I did, just cd to the split-path result instead. :)

What do you think? Useful or I’m the only one that would use it? :)
Jul 12, 2007 at 12:08 AM
Seems reasonable to me.
Jul 12, 2007 at 12:08 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Jul 24, 2007 at 6:10 PM
A quick workaround that I use frequently is:

cd <insert any path>\filename\..

which places me in the parent directory of the file. It works with Get-ChildItem, Set-Location, et al at least for the filesystem provider.