Is it possible to open a Windows Explorer window from PowerShell?

Viewed 155765

I'm sure this must be possible, but I can't find out how to do it.

Any clues?

11 Answers

Use:

ii .

which is short for

Invoke-Item .

It is one of the most common things I type at the PowerShell command line.

You have a few options:

Examples:

PS C:\> explorer
PS C:\> explorer .
PS C:\> explorer /n
PS C:\> Invoke-Item c:\path\
PS C:\> ii c:\path\
PS C:\> Invoke-Item c:\windows\explorer.exe
PS C:\> ii c:\windows\explorer.exe
PS C:\> [diagnostics.process]::start("explorer.exe")

Just use the Invoke-Item cmdlet. For example, if you want to open a explorer window on the current directory you can do:

Invoke-Item .
$startinfo = new-object System.Diagnostics.ProcessStartInfo 
$startinfo.FileName = "explorer.exe"
$startinfo.WorkingDirectory = 'D:\foldername'

[System.Diagnostics.Process]::Start($startinfo)

Hope this helps

Single line command ,this worked for me

explorer .\

Related