Reputation: 897
I would like to be able to navigate to a certain file, then open it using a Powershell command.
Upvotes: 75
Views: 161969
Reputation: 67
Below are some examples that add to the answers already authored by others:
The examples demonstrate slightly more advanced methods using additional syntax and/or flags, or they demonstrate special cases.
Using the invoke-item flag:
PS C:\> ii -path c:\directory\directory\directory
Issues often arise when a command accepts a filepath as an argument because the parser cannot parse all the characters that can makeup a filepath. For example, say you have a directory-path that is for a directory with a name that contains spaces (i.e. "C:\Documents\My Work Stuff"
). In a case like that you can use quotes to help communicate to the command-line's parser which part of the syntax your entering is the argument being passed to the command's path parameter. Below is an example of what that might look like.
PS C:\> ii -path "C:\Documents\My Work Stuff"
Note that the
-path
flag is optional.
ii
or invoke-item
explorer.exe
start
Upvotes: 3
Reputation: 301147
For Powershell and cmd compatible way (and I think the most common way):
start .
start c:\
Upvotes: 42
Reputation: 1
As 'open .' in mac will open the current directory, 'start .' in window PowerShell will do the same.
Upvotes: 0
Reputation: 189
Putting a dot after explorer.exe
will open the current directory:
explorer.exe .
Upvotes: 3
Reputation: 21
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.
Upvotes: 2
Reputation: 111
To open the current folder within the powershell type:
PS>> explorer.exe $(pwd)
Upvotes: 11
Reputation: 2888
another variant
hh c:\
hh http://stackoverflow.com/questions/8471106
hh $env:windir\help\WindowsPowerShellHelp.chm
Upvotes: -1
Reputation: 126732
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
Upvotes: 111
Reputation: 20247
I don't exactly understand what you want, but I have two possible solutions:
explorer .\Documents
or
cd .\Documents
Upvotes: 0
Reputation: 1807
you can use the explorer.exe to open the folder:
explorer.exe c:\temp\
explorer.exe <YourFolderPathHere>
Upvotes: 6