Sandbox/Explorer and TC: paths to Desktop

From TotalcmdWiki
Jump to navigation Jump to search

Both Explorer and TC allow to browse some special folders using either real fs path (starts with drive letter) or shell namespace (virtual) one (in Explorer such path usually starts with Desktop virtual object, in TC with \\ characters).

The logic of locating these paths for Desktop folders, real one of current user and virtual that combines items from current user and common Desktops, is opposite in TC and Explorer. And for TC, different places used to go to such paths get different results too.

Explorer and TC logic

(examples below may be incompatible with Windows older than Vista and also not tested with newer Windows versions)

Using real fs path of current user Desktop

a) In Explorer press Win+R, enter this and execute:

%userprofile%\Desktop

Result: Explorer will open virtual Desktop object.

b) Make a button in TC and execute it:

Button code
TOTALCMD#BAR#DATA:
cd %userprofile%\Desktop\

imageres.dll,104



-1

Result: TC goes to real fs path of current user Desktop folder.

Using CLSID (GUID) of Desktop virtual object

a) In Explorer press Win+R, enter this and execute:

::{59031a47-3f72-44a7-89c5-5595fe6b30ee}\{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}

Result: Explorer will go to real fs path of current user Desktop.

b) Make a button in TC and execute it:

Button code
TOTALCMD#BAR#DATA:
CD ::{59031a47-3f72-44a7-89c5-5595fe6b30ee}\{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}

imageres.dll,172
Desktop (CLSIDs)


-1

Result: TC will go to virtual \\Desktop\ object (although with content of Current user desktop, but with hidden files not visible).

We see that behaviour of filemanagers is opposite and yes, it seems like the Explorer behaviour is buggy. But what matters is that the behaviour of both file managers has own logic which should be followed in other places, and here we go to next chapter.

Shortcuts (LNK type)

Let's make two shortcuts, one will point Explorer to virtual Desktop object, another to real fs path to current user Desktop folder (we expect that TC will follow them in a way opposite to Explorer).

Shortcut to virtual Desktop object

In any folder in context menu select New->Shortcut, as a path to target enter:

%userprofile%\Desktop\

then set a name of shortcut, like "Desktop (virtual)" (withot quotes of course), and press Enter. Open this shortcut in Explorer,
result: Explorer will go to virtual Desktop object. This expected considering Explorer logic described in chapter 1.

Shortcut to real fs path of current user folder

To do this, following Explorer logic, we will need a path with CLSIDs.

But since I wanted to make a universal shortcut that will work in both Explorer and TC, and also as a target.lnk in "Folder shortcut", I couldn't use "Explorer.exe " or "Explorer.exe shell:" prefixes before CLSIDs. Since Windows shortcut maker can't create one with just CLSIDs, application "Link Editor", a part LinkInfo plugin, will get it done.

So make a copy of shortcut created in chapter 2.1, give to it a diffrernt name, like "Desktop (current user)", open it in Link Editor, enter following in "Target:" field and press Enter:

::{59031a47-3f72-44a7-89c5-5595fe6b30ee}\{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}

Open this shortcut in Explorer,
result: Explorer will go to real fs path of current user's Desktop folder. This expected considering Explorer logic described in chapter 1.

Check how TC follows these shotcuts

Open each of these shortcuts in TC.

Result: in both cases TC will go real fs path of current user's Desktop folder.

This is unexpected considering TC logic described in chapter 1: with shortcut made in chapter 2.2 TC should go to virtual \\Desktop\ folder.

Breadcrumbs

Since TC unfortunately doesn't follow "Folder shortcuts" that point to local target in real fs paths, we will test them in vitrual "Computer" folder.

Creating of Folder shortcuts

For that we will do following:

1) copy both of our shortcuts made in chapter 2 to following path: %appdata%\Microsoft\Windows\Network Shortcuts\

2) In that path, make folders with names of shortcuts (this and next is better to do using TC), than put the shortcuts to that folders (each to one of its name) and in that folders rename shortcuts to target.lnk. To complete conversion of folders to "folder shortcuts", apply necessary attribute(s) to the folders and desktop.ini and make a special desktop.ini in each, like mentioned in this forum topic.

Now we're returning to Explorer, because when this is done, such folders should show the content of the target after opening in Explorer (this will be a content of virtual Desktop object for "Desktop (virtual)" folder shortcut and the content of current user Desktop folder for "Desktop (current user)" folder.

Explorer's breadcrumb

Go to virtual "Computer" folder in Explorer, there our "Desktop (current user)" folder will also appear.

First, go to "Desktop (current user)" folder, and in address/breadcrumb bar press an arrow on the right side near the name of that folder. As expected, Explorer will show the subfolders of current user Desktop folder.

Then, return to "Computer" and then go to "Desktop (virtual)" folder. Check the breadcrumb as described above. As expected, after pressing an arrow Explorer will show the normal and special subfolders of Desktop virtual folder.

Total Commander's breadcrumb

In TC commandline, execute cm_SrcPathFocus and after breadcrumb arrow button will appear, using either mouse or keyboard navigate from Desktop virtual object to Computer and our "Desktop (virtual)" and "Desktop (current user)".

Result: TC will show the subfolders of current user Desktop for both, although considering TC logic described in chapter 1 it was expected that TC will show for "Desktop (current user)" folder the same breadcrumb content as for \\Desktop\ virtual folder.

Folder shortcuts and virtual folders

Total Commander won't follow to virtual Desktop object either when opening any of "Desktop (virtual)" or "Desktop (current user)" in "Computer" or when opening the target.lnk files in that folders in %appdata%\Microsoft\Windows\Network Shortcuts\ folder. Instead TC will go to the real fs path of the current user Desktop folder. But even here there's the new difference: going from "Computer" and folder shortcut will make TC to use a short (8.3) path, but going using a mentioned *.lnk files will make TC go to a current user Desktop folder using long path.