13

So basically I want to go to 192.xxx.xxx.xxx\myFolder to see the files in it. I go with Explorer and it works fine, I can even delete and/or modify and add files to it.

The problem is that I'm trying to go through: cd \\192.xxx.xxx.xxx\myFolder and it returns: CMD is not compatible with the UNC access routes as an actual directory (I'm translating this, as the original message is in spanish).

Hope this question makes sense,

Thanks a lot!

villancikos
  • 265
  • 2
  • 3
  • 9

2 Answers2

22

Use pushd to create a virtual drive:

pushd \\UNC\path

And to unmap the virtual drive and return to your previous local path:

popd
James Scholes
  • 371
  • 2
  • 6
  • I gather [that works](http://support.microsoft.com/kb/317379), but even for Microsoft, it's bizarre... – Aaron Miller May 10 '13 at 15:25
  • I suppose it makes sense because you can't just simply traverse into it. It has to mount the location to the filesystem first, and `pushd` can do so temporarily, pretty easily. – Ben Richards May 10 '13 at 15:30
  • @BenRichards: Windows mounts disks and network shares as soon as they're accessed; assigning a drive letter is entirely optional. It's an artificial limitation in `cmd.exe`. – u1686_grawity May 10 '13 at 15:34
  • @grawity Good point. And I'd say "compatibility with DOS" to that, except they already ditched any decent DOS compatibility with Vista. So, I suppose it really is bizarre. – Ben Richards May 10 '13 at 16:52
7

You can mount a network share to a drive letter and use this mount point in the command prompt. Obviously, you can mount through the graphical user interface, but also through the command line using the net use command, e.g.:

net use D: \\192.168.1.1\share && cd /D D:

Unmount using net use D: /DELETE. Consult net use /? for more flags, for instance if access to the share requires a password.

Marcks Thomas
  • 6,272
  • 2
  • 22
  • 37