My First Post      My Facebook Profile      My MeOnShow Profile      W3LC Facebook Page      Learners Consortium Group      Job Portal      Shopping


Tuesday, February 28, 2017

CD with mapped mounted drive on network : CHDIR command

It has happened with me that I was able to succesfully mount a network drive and can freely access it using Windows file-system Explorer. But my script was not able to access it. Digging a step further, i noticed that I could not even CD to that drive on command prompt. Hence i finally wrote this blog post for anyone running into the similar issue.

Question : How do I change to a mapped network drive at the command line?

Say, you have a networked drive mapped to "U:\"
Now you want to go to that drive from a command line.
However, when you try you get an error suggesting
C:>u: The system cannot find the drive specified.

There are two aspects to the solution:
1. The Syntax to use CD command on Windows may be the cause. Remember that for changing directories you should use cd /d U: rather than just U:
2. You should first start using the map drive on command prompt. Command used to do that is as follows:
net use u:

See attached screenshot showing the error as well as what happened after solution.

C:\Users\mfaiz\Downloads>net use p:
Local name        p:
Remote name       \\\ap-xxx
Resource type     Disk
The command completed successfully.

No comments:

Post a Comment