How to use UNC paths inside Windows Command prompt?.

If you are reading this article which means you want to open a UNC path from the command prompt. Yes I also wanted to play with some UNC paths just before write this article.




I thought it will be good if I share that knowledge with you.


It's easy just use "pushd" without quotes in front of the UNC path you want to use. This little command will assign your location as a temporary network location and will treat the location as a drive. To remove the network drive assignment you need to place "popd" at the end of the script.


pushd \\Server\my_share
          #Rest
          #of
          #the
          #script

          popd 




Hope this helped.

Comments

  1. Thanks for explaining how to use the network drive assignment in this case.

    ReplyDelete
You are welcome to share your ideas with us in the comments!

Archive

Contact Form

Send