PowerTip: Open Windows Explorer to a Location


Summary: Easily open the Windows Explorer to a specific location in Windows PowerShell.

Hey, Scripting Guy! Question How can I use Windows PowerShell with the Windows Explorer graphical tool to browse through the files in
           my home directory or documents location?

Hey, Scripting Guy! Answer Use the Explorer program name and follow it with the location. For your home directory, use the 
           $Home automatic variable:

explorer $HOME

Note  To easily access your documents folder, you can use the variable that I created in 
           I Have a PowerShell Profile—Now What?:

Explorer $doc

Comments (6)

  1. JV says:

    $file=c’:testtest.txt’
    explorer (split-path (Resolve-Path $file))
    $file=’test.txt’
    explorer (split-path (Resolve-Path $file))

  2. Jeff Hicks says:

    Or use Invoke-Item:
    invoke-item $home

    Use an alias and save a few keystrokes:
    ii $home
    ii c:windows

  3. tommymaynard says:

    Like Jeff Hicks mentions, I use ii all the time.
    ii .
    ii ..

  4. MJ says:

    And the reverse of this, open powershell to a location from explorer. Navigate to the folder you wish to open in powershell, go to the address bar (Alt+D), clear it out, type powershell and hit enter.

  5. OldFart says:

    Or, use Invoke-Item.

    ii $HOME

  6. Adil Hindistan says:

    I normally use ‘ii $Home ‘ as Jeff mentioned below. Start could be used instead of ‘explorer’

    start $home
    start $doc

    I love the tip from MJ!

Skip to main content