Arnout's Eclectica

But I digress…

CMD does not support UNC paths as current directories. Use PUSHD instead.

25 April 2006 20:41 — Tips & Tricks,Windows

CMD.exe does not allow changing the current directory to a UNC path. If you try, it complains that "CMD does not support UNC paths as current directories.".

PUSHD to the rescue:

C:\\> pushd \\\\serendipity\\D$

   Do something here with the files on Z:

Z:\\> popd
C:\\> _

PUSHD temporarily maps a drive letter to the specified UNC share (starting from Z: on down until it finds one that's available). Until you call POPD, you can access the share via that drive letter (also from other DOS boxes and Windows Explorer).

Sure beats mapping and unmapping shares all the time, but keep in mind that the PUSHD trick only works if you don't need to specify credentials to access the share.

Copyright © 2006-2009 Arnout Grootveld — Powered by WordPress — Hosted at pair Networks