For years, I have accepted that the Windows command prompt doesn't support UNC paths as the current directory. However, a few weeks ago, two of my colleagues reported that they could run batch files from a UNC directory.
I have have not been able to figure out what's special with these two machines. Can anyone explain this, and if possible, tell me how to setup my own command prompt to accept UNC paths?
To show you the difference, we have created a small batch file, saved it in "\rpfil01\Projects\test" and executed it from the same UNC path.
Batch file contents:
ver
dir randomFolder
cd randomFolder
pause
The results are attached as UNC supported.jpg and UNC not supported.png. As you can see from "UNC not supported.png", my machine simply defaults to "C:\Windows", but on my colleague's machine ("UNC supported.jpg") the UNC path is used as the current directory.
However, when a command prompt is using a UNC path as the current directory, "cd" cannot be used to go up or down in the directory tree. This can be seen from "UNC supported.jpg", where the dir command is able to list the contents of "randomFolder" but the cd command is unable to change the current directory to "randomFolder".
As you can see from the attached images, our Windows versions differ (even if both machines are up to date according to Windows Update). Can this behavior be some kind of bug in the older Windows version? If so, a very convenient bug. ;-)