Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to open a folder within Powershell

Tags:

powershell

People also ask

How do I find a folder in PowerShell?

On a Windows computer from PowerShell or cmd.exe, you can display a graphical view of a directory structure with the tree.com command. To get a list of directories, use the Directory parameter or the Attributes parameter with the Directory property. You can use the Recurse parameter with Directory.

How do I open a folder in PowerShell 7?

Click Start, type PowerShell, and then click Windows PowerShell. From the Start menu, click Start, click All Programs, click Accessories, click the Windows PowerShell folder, and then click Windows PowerShell.

How do I open a folder in PowerShell Windows 11?

#5 windows 11 Open PowerShell in a Folder Just input “powershell” in the address bar of Windows Explorer and press Enter. Or, you can directly go to C:\Windows\System32\WindowsPowerShell\v1. 0, find the PowerShell or PowerShell ISE executable file, and double-click on it to run the PowerShell.


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:\

To open the current folder within the powershell type:

PS>> explorer.exe $(pwd)


Use Invoke-Item, alias ii:

ii d:\temp\

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

explorer.exe c:\temp\
explorer.exe <YourFolderPathHere>

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.


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