62

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
  • 767
  • 1
  • 6
  • 7
  • 6
    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

92

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
  • 114,369
  • 30
  • 175
  • 198
33

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

start .
start c:\
manojlds
  • 275,671
  • 58
  • 453
  • 409
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
  • 27,607
  • 11
  • 68
  • 102
6

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

explorer.exe c:\temp\
explorer.exe <YourFolderPathHere>
oberfreak
  • 1,781
  • 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
  • 49
  • 2
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

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

explorer.exe .
Zuhair Abid
  • 80
  • 1
  • 7
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
  • 18,151
  • 8
  • 74
  • 79
-1

another variant

 hh c:\

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

 hh $env:windir\help\WindowsPowerShellHelp.chm
walid2mi
  • 2,566
  • 14
  • 13