2

Windows has a few folders such as "Documents", "Pictures", "Downloads", etc... which can be accessed from the quick access bar on the left of Explorer or from the "Home" tab. Clicking the button to go up one level from these folders will bring you back to Home or Desktop, depending on how you got there in the first place.

These folders are really located in something like C:\Users\user1\Documents, or perhaps C:\Users\user1\OneDrive\Documents, so when I go up one level, I really want to go to C:\Users\user1\ or C:\Users\user1\OneDrive\.

Is there an easy way to do this?

Toto
  • 17,001
  • 56
  • 30
  • 41
Edward
  • 143
  • 5
  • Best option m,ight be to just pin a shortcut to `%USERPROFILE%` to quick access. That will take you to "C:\Users\user1" – Blind Spots Feb 10 '23 at 15:22
  • @BlindSpots Interestingly, I can't go one level up from %userprofile% to C:\Users - it takes me to Desktop. So I'd just use a shortcut to C:\Users\user1. – Edward Feb 10 '23 at 17:19
  • To do that, you would conceivably need to have the full UNC path avaiable. Take a look here and see if this provides you with what you need: [Always show absolute path in File Explorer address bar](https://superuser.com/questions/1362386/always-show-absolute-path-in-file-explorer-address-bar) – Run5k Feb 10 '23 at 18:47
  • @Run5k Wow, I think I'm asking for what that asker really wanted. Those solutions might be the best I will find. – Edward Feb 10 '23 at 21:01

1 Answers1

0

The following is valid for Windows 10, I haven't upgraded to 11, so no clue as to how Explorer behavior may have changed.


A coupl.e of years ago, I created a simple context menu entry for the Dorectory Bacground context menu:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\OpenLocation]
@="&Open file-system location"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\OpenLocation\command]
@="\"explorer.exe\" \"%v\""

It opens a new Explorer window to the file-system location of the folders under This PC,shell:UsersFilesFolder (user profile folder rooted at Desktop), etc. But opening a new window seems clunky. It seems "cleaner" to navigate within the existing window. So seeing this question made me re-visit and come up with this PowerShell snippet:

@((New-Object -com shell.application).Windows()).ForEach({
    Try{$_.Navigate2($_.LocationURL)}
    Catch{}
})

It will navigate all open Explorer windows that are currently displaying a namespace junction to their file-system locaiton.

To create a context menu shortcut to run this code without window flash:

$encodedCommand = [Convert]::ToBase64String([System.Text.Encoding]::Unicode.GetBytes( '@((New-Object -com shell.application).Windows()).ForEach({Try{$_.Navigate2($_.LocationURL)}Catch{}})'))

$CommandLine = 'cmd.exe /c start /min Powershell -NoProfile -ExecutionPolicy Bypass -EncodedCommand ' + encodedCommand

$Key = 'HKCU:\SOFTWARE\Classes\Directory\Background\Shell\NavToFSLocation'

[PSCustomObject]@{
    '(Default)' = 'Open file-system location'
    'Position' = 'Top'
} | Set-ItemProperty -Path (mkdir $Key -Force).PSPath

New-Item -Path $Key -Name 'Command' -Value $CommandLine

If you prefer a .reg file:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\SOFTWARE\Classes\Directory\Background\Shell\NavToFSLocation]
@="Open file-system location"
"Position"="Top"

[HKEY_CURRENT_USER\SOFTWARE\Classes\Directory\Background\Shell\NavToFSLocation\Command]
@="cmd.exe /c start /min Powershell -NoProfile -ExecutionPolicy Bypass -EncodedCommand QAAoACgATgBlAHcALQBPAGIAagBlAGMAdAAgAC0AYwBvAG0AIABzAGgAZQBsAGwALgBhAHAAcABsAGkAYwBhAHQAaQBvAG4AKQAuAFcAaQBuAGQAbwB3AHMAKAApACkALgBGAG8AcgBFAGEAYwBoACgAewBUAHIAeQB7ACQAXwAuAE4AYQB2AGkAZwBhAHQAZQAyACgAJABfAC4ATABvAGMAYQB0AGkAbwBuAFUAUgBMACkAfQBDAGEAdABjAGgAewB9AH0AKQA="

Keith Miller
  • 8,704
  • 1
  • 15
  • 28