4 ms·
> 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/wi
by ChrisSD 3y 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 3y 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)