Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.
C:\> cd \\somewhere
'\\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
5  
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. –  Kyle 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
show 1 more comment

5 Answers

If you're using XP you can have a look at this site http://support.microsoft.com/kb/156276

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) http://support.microsoft.com/kb/317379

share|improve this answer
add comment

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

http://code.kliu.org/cmdopen/

enter image description here

share|improve this answer
3  
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
add comment

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.

Example:

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

C:\a\local\path>
share|improve this answer
2  
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
add comment

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

http://www.rejetto.com/hfs/

it's amazing

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

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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.