Akshada Pradhan
Akshada Pradhan

Reputation: 33

How do I open a folder(on my desktop) from Powershell on Windows?

On an online tutorial on webservers, the guy(on a MAC) opened a folder which was on his desktop by typing **>> cd folder-2

open .** how do I do the same(equivalent to double clicking on the folder) using Powershell?

Upvotes: 2

Views: 12826

Answers (2)

Jeff Zeitlin
Jeff Zeitlin

Reputation: 10754

There are three ways that immediately come to mind:

  1. start $folder, where $folder is the path of the folder to open - it can be either a fully qualified pathname (e.g., C:\Users\Me\Documents\Letters) or a relative pathname (e.g., Letters)

  2. Invoke-Item $folder, where $folder is the path of the folder to open, as above. By default, Invoke-Item has an alias, ii.

  3. explorer $folder, where $folder is the path of the folder to open, as above.

Method 1 also works in cmd.exe. Both method 1 and method 2 can also take a file name instead of a folder pathname, and will cause the default action for the item to occur - for example, Invoke-Item notes.txt or start notes.txt will open notes.txt in notepad (or your system default text editor).

Upvotes: 5

KlapenHz
KlapenHz

Reputation: 73

In cmd powershell type:

explorer.exe $path

where $path is the name of folder with full path

Upvotes: 0

Related Questions