Explorer in Explorer Mode
I tend to fire up Windows Explorer instances from my prompt very often, either on the current directory or in other spots. I was pretty used to using the “explorer /e,<path>” command from CMD.EXE but I never had figured out exactly how to use it on PowerShell and have it work reliably: Paths with spaces always caused it to open the default documents folder instead.
Finally sat down and played with it until I got it right:
# open explorer in this directory
function exp([string] $loc = '.') {
explorer "/e,"$loc""
} 





Try ‘invoke-item -path .’ or ‘ii .’
James
If James hadn’t said that I was going to.
Thanks guys! Yes, it occurred to me later on that I could just "execute" the path and get the right behavior, but, to be honest, getting the right explorer parameters was a challenge I wanted to get done
(I’m still not 100% sure why the above works while "/e,`"$loc`"" didn’t).
Never have used that command, thanks for sharing (I always used "start ."). Strangely enough, both these commands worked without errors:
$loc = "."
explorer "/e,"$loc""
explorer "/e,`"$loc`""
Jason: Yes, that works for me if $loc doesn’t have spaces in it. That’s when it breaks for me.