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
  • 33,626
  • 12
  • 54
  • 99
Phil
  • 31
  • 3

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
  • 36,585
  • 5
  • 27
  • 39