68

How to open a folder in PowerShell? I am not talking on how to start PowerShell in a specific folder.

What I mean is that in the command line of powershell i would like to open a folder e.g: " open document"

bill
  • 827
  • 1
  • 7
  • 7
  • 7
    possible duplicate of [Is it possible to open an explorer window from powershell](http://stackoverflow.com/questions/320509/is-it-possible-to-open-an-explorer-window-from-powershell) – manojlds Dec 12 '11 at 07:35

11 Answers11

101

Use the Invoke-Item cmdlet, or its alias: ii.

PS> ii c:\windows # open the windows directory in windows explorer
PS> ii c:\book.xls # open book.xls in Excel
PS> ii . # open the current directory in windows explorer
Shay Levy
  • 121,444
  • 32
  • 184
  • 206
35

For Powershell and cmd compatible way ( and I think the most common way):

start .
start c:\
manojlds
  • 290,304
  • 63
  • 469
  • 417
10

To open the current folder within the powershell type:

PS>> explorer.exe $(pwd)

rmbd
  • 101
  • 1
  • 2
9

Use Invoke-Item, alias ii:

ii d:\temp\
stej
  • 28,745
  • 11
  • 71
  • 104
6

you can use the explorer.exe to open the folder:

explorer.exe c:\temp\
explorer.exe <YourFolderPathHere>
oberfreak
  • 1,799
  • 13
  • 20
3

Just to add as well to the mix:

PS C:\> ii -path c:\directory\directory\directory

If your file name has two words with a separation consider single quotation marks:

PS C:\> ii -path 'c:\directory\directory\directory directory\'

The following work [note -path is optional]

   1. ii or invoke-item
   2. explorer.exe
   3. start
Boi G
  • 57
  • 2
3

Putting a dot after explorer.exe will open the current directory:

explorer.exe .
Zuhair Abid
  • 139
  • 1
  • 9
2

I realize the question is old but folks finding this via google may find this useful even now:

I created a cmd script with:

@REM Open directory
@REM Version 1.0
@echo off
if [%1]==[] (powershell ii .
    ) Else (
        powershell ii %1
        cd %1
    )

This will also open a document such as a text file or a MS Word document, as well as opening a folder.

0

As 'open .' in mac will open the current directory, 'start .' in window PowerShell will do the same.

GBroll
  • 1
0

I don't exactly understand what you want, but I have two possible solutions:

explorer .\Documents

or

cd .\Documents
Ocaso Protal
  • 19,362
  • 8
  • 76
  • 83
-1

another variant

 hh c:\

 hh http://stackoverflow.com/questions/8471106

 hh $env:windir\help\WindowsPowerShellHelp.chm
walid2mi
  • 2,704
  • 15
  • 15