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 Comments2 Solutions945 ViewsLast Modified:
Hi,

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;
eg/
   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! :-)


ASKER CERTIFIED SOLUTION
PWeerakoon

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

Join our community to see this answer!
Unlock 2 Answers and 10 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 10 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros