29

I can list all files in a folder with: dir \\aenw08v401\FOLDER\I001\*

However, when I execute cd \\aenw08v401\FOLDER\I001, the current working directory won't change at all.

This is what I see when I execute net view \\aenw08v401:

Shared resources at \\aenw08v401 Share name Type Used as Comment ----------------------------------- FOLDER Disk The command completed successfully. 

Is there a switch I am missing, or do I need to use a different command?

1

1 Answer 1

45

The Windows command prompt cmd does not support UNC paths as current directories.

C:\Users\User1>cd \\myServer\myShare CMD does not support UNC paths as current directories. 

Solution: Use pushd.

C:\Users\User1>pushd \\myServer\myShare Z:\>dir Volume in drive Z is MYDRIVE Volume Serial Number is 1234-5678 Directory of Z:\ 12/16/2015 11:18 AM <DIR> . 12/16/2015 11:18 AM <DIR> .. 0 File(s) 0 bytes 2 Dir(s) 120,609,575,936 bytes free Z:\>popd C:\Users\User1> 

Alternate Solution: Map the UNC path to a drive letter.

C:\Users\User1>net use Y: \\myServer\myShare The command completed successfully. C:\Users\User1>Y: Y:\>dir Volume in drive Y is MYDRIVE Volume Serial Number is 1234-5678 Directory of Y:\ 12/16/2015 11:18 AM <DIR> . 12/16/2015 11:18 AM <DIR> .. 0 File(s) 0 bytes 2 Dir(s) 120,609,575,936 bytes free Y:\>C: C:\Users\User1>net use /delete Y: Y: was deleted successfully. 
3
  • 2
    The pushd solution worked perfectly for me, though in the end psexec worked out better for me Commented Dec 17, 2015 at 12:36
  • 2
    Or use PowerShell where cd \\Server\path just works. Commented May 10, 2018 at 20:44
  • I first tried the second one, it worked like magic. Commented Nov 19, 2021 at 16:28

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.