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:

Professional Opinions
Ask a Question
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

troubleshooting Question

Find drive letter of a named drive

Avatar of Julian Parker
Julian ParkerFlag for United Kingdom of Great Britain and Northern Ireland asked on
Microsoft DOSWindows XP
10 Comments1 Solution945 ViewsLast Modified:

I want to write a simple backup batch file to backup to a USB drive amongst other things.

I can list the volume using diskpart /s diskscript.txt where diskscript.txt has "list volume" in it and then search for the diskname;
   diskpart /s diskscript.txt | find "BACKUP"

I now need to extract the disk volume from the string and assign it to a variable.
  Volume 4     F   BACKUP    FAT32  Removeable  1934 MB

I don't want to hard code the drive letter in the script as it may change. If awk was available as standard I'd be ok :-).

Is there a MSDOS alternative?

O/S is Windows XP Home/Professional.

I will up the points for a quick response... hell I may even do it anyway! :-)

Avatar of PWeerakoon
PWeerakoonFlag of United States of America image

Our community of experts have been thoroughly vetted for their expertise and industry experience.

This problem has been solved!
Unlock 1 Answer and 10 Comments.
See Answers