4 ms·
So many things wrong with this article. Some things that I noticed by skimming over it: > UNC paths can also be used to access local drives in a similar way:
by dark-star 4y ago
So many things wrong with this article. Some things that I noticed by skimming over it:
> UNC paths can also be used to access local drives in a similar way:
> \\127.0.0.1\C$\Users\Alan Wilder
> UNC paths have a peculiar way of indicating the drive letter, we must use $ instead of :.
This is actually incorrect... He's actually accessing some random share that has no real connection to a drive. Yes, sometimes (quite often), the C$ share corresponds to the C: drive's root, but this is by no means given, as one can easily either delete the C$ share, or have it pointing to somewhere else entirely
> When the current directory is accessed via a UNC path, a current drive-relative path is interpreted relative to the current root share, say \\Earth\Asia.
This is also wrong. There is no "current directory" on an UNC share (which can easily be shown by trying to open a command prompt on a UNC share, it will show an error and start you somewhere on C:\users), and the example he gives just tries to access the share "Asia" on the server "Earth"
> Less commonly used, paths specifying a drive without a backslash, e.g. E:Kreuzberg, are interpreted relative to the current directory of that drive. This really only makes sense in the context of the command line shell, which keeps track of a current working directory for each drive.
Also wrong, it's not the command line shell that keeps track of the current directories, it's the Windows kernel itself. But I agree that such a scenario is quite useless as you can never be quite sure on what CWD you are on a given drive
> For the most part, : is also banned. However, there is an exotic exception in the form of NTFS alternate data streams.
Yeah, well, surprise: the ":" is not part of the file name, it's just a separator between filename and stream name. This is like saying that "you cannot have \ characters in a file name, but in directory names it is allowed". No, it's not. It's a separator
- ChrisSD 4y ago> There is no "current directory" on an UNC share SetCurrentDirectory allows setting the current directory to a UNC share. https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-setcurrentdirectory https://learn.microsoft.com/en-us/windows/win32/api/winbase/... > Also wrong, it's not the command line shell that keeps track of the current directories, it's the Windows kernel itself. But I agree that such a scenario is quite useless as you can never be quite sure on what CWD you are on a given drive Not for a long time. It's set as a special (hidden) environment variable like `=C:=C:\current\directory`. https://devblogs.microsoft.com/oldnewthing/20100506-00/?p=14133 https://devblogs.microsoft.com/oldnewthing/20100506-00/?p=14...
- muststopmyths 4y ago>SetCurrentDirectory allows setting the current directory to a UNC share. Exactly. The cmd prompt not setting UNC paths as current directory was introduced around Windows 2000 (or maybe post-XP, it's been a while) to help legacy batch files being run from a share and then getting confused by being on a UNC path instead of one beginning with a drive letter. This was also why, when you do a pushd \\server\share cmd.exe puts you on a mapped drive instead of directly on a UNC path. If you use the Windows native version of tcsh, for example, you can happily use UNC paths as current directories and run commands (provided they don't try to parse drive letters from their CWD)
- pixl97 4y ago> we must use $ instead of :. Eh, I just thought the $ in a Windows NAS share was to ensure the share was hidden from browsing. Microsoft used to have documentation on that, but seems to be missing from their site after they removed old articles.
- dark-star 4y agothat's exactly the reason, yes