Search code examples
windowspowershellcmddirectory

How to open 'This PC' using CMD or Powershell?


I need a way of opening the explorer at This PC , in the same way as opening in a windows explorer Gui, but I am incapable of this as using Explorer.exe in CMD opens quick access.

I tried opening it with a shortcut and that too failed.

Does anyone know of a way to do this?

Cheers


Solution

  • Just like you can run explorer.exe C:\ to open up the C: (or any other drive or folder path), you can also use a file: URI to open paths in Explorer as well. If you just specify the file: protocol without a directory (or specify file:\\), it will open This PC:

    explorer file:
    explorer file:\\
    

    Note that you can also change the default Explorer location from Quick Access to This PC as well from Folder Options:

    Folder Options

    You can set this in the registry too if you're after automation to configure this. See my answer on how you can use PowerShell to set the default launch folder in the registry.