We help IT Professionals succeed at work.
Get Started

WinXP Batch: How to get the UNC Server's name of a file in a mapped network drive?

1,149 Views
Last Modified: 2012-05-12
I have a variety of mapped network drives on my computer. They reconnect automagically.

I want to have a batch file that can, given a file's path as the %1 input parameter to the batch script...
e.g. "Z:\Folder\Demo.pdf"

... find out what the UNC path of the Z:\ drive is (like "\\Servername\Shared\".

Example:
Input: Z:\Folder\Demo.pdf
Batch File Takes "Z:\" and Translates to "\\Servername\Shared"

Can batch do this?
Comment
Watch Question
Commented:
This problem has been solved!
Unlock 2 Answers and 10 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE