Accessing Network File Shares From A Command Prompt
March 8th, 2007 Adrian Banks 12108 Views
If you've ever tried to access a network file share in a command prompt by simply using the cd command, you'll know that it just complains that "CMD does not support UNC paths as current directories". Well, there is a way to do it (two in fact):
Both of these approaches map the network share to a local drive letter that you can change to using the cd command.
The first one can be combined with the /user switch to provide additional user details:
The bonus of using the pushd command over the net use command is that it will automatically change the current directory to the mapped drive (which will be the first unused drive letter available in reverse alphabetical order). Also, when finished with the network share, you can use the popd command to remove the mapped drive.
Entry Filed Under: Windows
8 Comments Add your own
1. allion | August 8th, 2008 at 17:40
Thanks a lot. I was searching for this command.
2. allion | August 9th, 2008 at 13:09
I used the POPD command but I can't still remove the newly created drive?
3. Adrian Banks | August 9th, 2008 at 16:10
Did you use pushd to map the drive? If so, popd should remove it. If you used "net use", you will have to disconnect the drive by right clicking on it in explorer and choosing the disconnect option.
4. Rajam | May 7th, 2009 at 11:29
You can use the following command to delete the mapped drive from command prompt.
net use /delete
eg: net use z: /delete
It will delete mapped network drive "Z" from your computer.
5. P.Venkateswara Rao | September 18th, 2009 at 6:30
It's Cool. Thanks
6. shailesh | October 16th, 2009 at 8:42
Thank you very much.. The information really helped a lot..
7. Kelly | April 8th, 2010 at 18:26
brilliant thank you!
8. shiva | July 15th, 2010 at 11:29
Hi There,
Thanks a lot for the command.I was looking for this.
I have a requirement where i need to place a file from local into the network drive.How can i do this.
when i tried the above command it is throwing an error like the network name cannot be found.
I am tring to map the network drive to the local and using xcopy want to place file in it.
Any inputs...
Regards,
shiva.
Leave a Comment
Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>
Trackback this post | Subscribe to the comments via RSS Feed