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

后端 未结 10 516
小鲜肉
小鲜肉 2020-12-07 07:21

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

Any clues?

相关标签:
10条回答
  • 2020-12-07 07:44
    $startinfo = new-object System.Diagnostics.ProcessStartInfo 
    $startinfo.FileName = "explorer.exe"
    $startinfo.WorkingDirectory = 'D:\foldername'
    
    [System.Diagnostics.Process]::Start($startinfo)
    

    Hope this helps

    0 讨论(0)
  • 2020-12-07 07:46
    explorer .
    
    0 讨论(0)
  • 2020-12-07 07:46

    I came across this question looking for a way to open an Explorer window from PowerShell and also select a file. I'm adding this answer in case others come across it for the same reason.

    To launch Explorer and select a file, use Invoke-Expression:

    Invoke-Expression "explorer '/select,$filePath'"
    

    There are probably other ways to do this, but this worked for me.

    0 讨论(0)
  • 2020-12-07 07:56

    Use any of these:

    1. start .
    2. explorer .
    3. start explorer .
    4. ii .
    5. invoke-item .

    You may apply any of these commands in PowerShell.

    Just in case you want to open the explorer from the command prompt, the last two commands don't work, and the first three work fine.

    0 讨论(0)
提交回复
热议问题