pushd \\network\path returns CMD does not support UNC paths as current directories

17,944

Solution 1

From pushd /?:

If command extensions are enabled the PUSHD command accepts network paths in addition to the normal drive letter and path. If a network path is specified, PUSHD will create a temporary drive letter that points to the specified network resource and then change the current drive and directory.

Do any mapped drives show up in net use after pushd is executed?

If you're not getting some kind of network authorization error, make sure command extensions are enabled (I'm not sure why they wouldn't be.)

cmd /x will enable extensions for the current CMD session. Try that prior to executing your batch script.

The "main switch" is in HKEY_CURRENT_USER\Software\Microsoft\Command Processor. EnableExtensions should be (DWORD) 1

Solution 2

Be sure to also check that you haven't just run out of drive letters. If you have a rogue script that isn't using popd after it's done with the drive, or is crashing before it gets to popd, you can end up with a bunch of garbage mapped drive. Easy to check as they'll show up in net use and "My Computer". For some reason cmd will give this cryptic error (CMD does not support UNC paths as current directories.) instead of telling you it ran out of drives to map to.

Share:
17,944
Steve H
Author by

Steve H

Updated on June 07, 2022

Comments

  • Steve H
    Steve H almost 2 years

    I was using a batch file to access some files from network.

    I am using

    pushd \\Network\path 
    

    to navigate to the networked directory to initiate some scripts

    My bat file was working perfectly fine till this morning I saw "cmd returning CMD does not support UNC paths as current directories".

    I have seen this error message when using cd instead of pushd to navigate to a network directory but I can figure out why I am getting error for a previously working bat file.

    And I did make sure that network location was online and accessible other way round.