Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top
C:\> cd \\somewhere
CMD does not support UNC paths as current directories.

What I usually do to get around this is to map that directory to a network drive and then I could easily access it from the command prompt.

But is there an easier way on how to get around this?

share|improve this question
which windows do you use? If it's Windows 7, you've powershell preinstalled on your system. Powershell supports unc-paths and cmd-commands (with few exceptions). – wullxz May 13 '11 at 11:27
You can always browse to the unc path through run. – Not Kyle stop stalking me May 13 '11 at 11:45
@wullxz: cheers, I didn't know you could browse UNC paths with PowerShell. @kyle: That's actually a valid answer according to my question :) But I want to access it from a command line environment. Will modify my question to make this more clear. – Andreas Grech May 13 '11 at 12:09
If your problem is that you need to work just from the command line, you can map the network drive with the 'net' command: net use x: \\computer name\share name – Al Crowley May 13 '11 at 12:11
@Aleister Crowley: Yes I know, but I'm asking if there's an easier way that doesn't involve mapping a network drive. – Andreas Grech May 13 '11 at 12:12
up vote 72 down vote accepted

If you use pushd and popd instead of cd you won't get that UNC error.

pushd <UNC path> will create a temporary virtual drive and get into it.
popd will delete the temporary drive and get you back to the path you were when you entered pushd.


C:\a\local\path> pushd \\network_host\a\network\path

U:\a\network\path> REM a temporary U: virtual drive has been created

U:\a\network\path> popd

C:\a\local\path> REM the U: drive has been deleted

share|improve this answer
Using pushd creates a drive mapping to the network share and then changes into a path relative to the share it creates. popd disconnects the share. – Dov Sep 6 '12 at 15:55

Kliu's "ContextConsole Shell Extension" (aka Open Command Prompt) says it, "can even open directories from network paths (UNC paths)" (from an Explorer window).

enter image description here

share|improve this answer
This program is most awesome! – afrazier May 13 '11 at 16:37
i'm shocked by the screenshot, it exist! – LiuYan 刘研 Jun 21 '12 at 11:01

I also hit the UNC problem with C:\> cd \\somewhere in a C program. Found this page and learnt about the net command: net use x: \\computer name\share name and used it successfully! Thanks to all who post their experiences for others to learn from. :-)

share|improve this answer
Yes, but using net use will map that location to a network drive and that is not what I wanted. – Andreas Grech Jan 28 '13 at 12:36
@AndreasGrech, Actually pushd does that too. – Pacerier Jan 24 '15 at 6:48
This works well in Far+ConEmu, unlike pushd. – Dzmitry Lahoda Jun 3 at 11:29

I use Git Bash to do this, since I already have it installed.

enter image description here

As an added bonus:
It also has better colors, let's me use ls, rm, etc., and uses the correct slash for paths. :P

share|improve this answer

If you're using XP you can have a look at this site

There is a registry value that you need to add, log out, log in again ... and now your cmd.exe does support UNC-Paths. It seems to me that you still can't cd to the path, but you can use it in other commands like dir, copy ...

An alternative might be using the pushd command, that will let you switch to the share (i guess by assigning it a temporary drive letter)

share|improve this answer
The pages you linked seem like empty pages...... – Pacerier Jan 24 '15 at 6:49
The links work here. Have you tried using https? – BigBlackDog Jan 27 '15 at 8:21

You can use the HttpFileServer application, it' over windows, very light and very easy to configure , it allow you to share a network folder UNC ( \server\share ) with HTTP protocol and the HTTP link can be used in any HTML page

it's amazing

share|improve this answer
Not very useful to a command line user. – Isaac Rabinovitch Oct 20 '12 at 5:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .