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"
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"
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
For Powershell and cmd compatible way ( and I think the most common way):
start .
start c:\
you can use the explorer.exe to open the folder:
explorer.exe c:\temp\
explorer.exe <YourFolderPathHere>
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
Putting a dot after explorer.exe
will open the current directory:
explorer.exe .
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.
As 'open .' in mac will open the current directory, 'start .' in window PowerShell will do the same.
I don't exactly understand what you want, but I have two possible solutions:
explorer .\Documents
or
cd .\Documents
another variant
hh c:\
hh http://stackoverflow.com/questions/8471106
hh $env:windir\help\WindowsPowerShellHelp.chm