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, 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""

Tomas Restrepo

Software developer located in Colombia. Sr. PFE at Microsoft.