Tuesday, June 15, 2010

subst weirdness with Windows Explorer

In my last post I mentioned that there are practical ways for users to work around the 260-character limit in many Win32 API functions that affect the operation of most Windows programs. One of them is the substr command built in to the cmd shell. I used substr to map Y: to my %USERPROFILE% (typically something like C:\Documents and Settings\username). And it all basically works.

Except for a couple things in Windows Explorer. First, the My Documents folder doesn't show up under Y: in Explorer. It shows up if I issue dir in cmd, and I can successfully browse to Y:\My Documents by typing that into the address bar in Explorer. It even auto-completes. It just doesn't show up. Second, and more seriously, Explorer treats this directory as if it's another drive when copying and moving files. So the default action dragging files between subdirectories of C: and Y: is copy, not move. And when you move the files it appears to re-write them instead of just re-writing the paths. Wack.

No comments: