allow function:cd to accept a file

Topics: Developer Forum, User Forum
Jul 6, 2007 at 3: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? :)
Coordinator
Jul 11, 2007 at 11:08 PM
Seems reasonable to me.
Coordinator
Jul 11, 2007 at 11:08 PM
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 5: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.