How to Open a Folder with PowerShell (With Example)


Often you may want to use PowerShell to open a specific folder.

You can use the Invoke-Item cmdlet to do so:

Invoke-Item c:\users\bobbi\data1

This particular example will open the folder located at the path c:\users\bobbi\data1 in the Windows Explorer.

If you’d like, you can also use the alias ii to perform the same task:

ii c:\users\bobbi\data1

This shorter syntax will also open the same folder.

The following example shows how to use this syntax in practice.

Example: How to Open a Folder with PowerShell

Suppose that we would like to use PowerShell to open the following folder in Windows Explorer:

  • c:\users\bobbi\data1

We can use the following syntax to do so:

Invoke-Item c:\users\bobbi\data1

The following screenshot shows how to use this syntax in practice:

PowerShell open folder

Once we run this command, the data1 folder is opened in Windows Explorer:

Note that we can also use the Invoke-Item cmdlet to open a specific file if we’d like.

For example, we can use the following syntax to open the file named athletes.txt located in a specific folder:

Invoke-Item c:\users\bobbi\athletes.txt

The following screenshot shows how to use this syntax in practice:

Once we run this command, the athletes.txt file will automatically be opened in Notepad:

Feel free to specify any path that you would like with the Invoke-Item cmdlet in PowerShell to open a specific file or folder.

Note: You can find the complete documentation for the Invoke-Item cmdlet in PowerShell here.

Related Tutorials

The following tutorials explain how to perform other common tasks in PowerShell:

PowerShell: How to Sort Files in Folder by Size
PowerShell: How to Unhide a Folder
PowerShell: How to Copy and Rename a File
PowerShell: How to Rename File Extension of Multiple Files

Leave a Reply