0

My goal is to retrieve the letters of every partition and loop through those to complete another task on each partition using that letter as a variable. Currently right now I have...

wmic logicaldisk get caption

which returns...

Caption  
C:       
D:       

Now how do I take that output, and take only C, then D, as a variable for a batch script?

Thank you very much, appreciate the help.

aschipfl
  • 31,767
  • 12
  • 51
  • 89
Phil
  • 31
  • 1

1 Answers1

2

Probable code example:

@Echo Off
For /F "Skip=1 Delims=:" %%A In ('WMIC LogicalDisk Get Caption') Do Echo=%%A:
Timeout -1

Change Echo= to an appropriate command as necessary.

Compo
  • 34,184
  • 4
  • 22
  • 36