0

I have this batch command:

for /f "tokens=1,2 skip=1" %%a in ('wmic logicaldisk get caption ^, freespace') do echo %%a %%b

How to convert the result into GB?
Why will the result appear if echo is off when the result is printed?

Reddy Lutonadio
  • 17,120
  • 4
  • 14
  • 35
Albert
  • 1
  • 1

1 Answers1

0

Use this:

for /f "tokens=2,3 delims==" %%a in ('wmic logicaldisk get caption, freespace /format:value') do set /a gb=%%b / 1024 / 1024 / 1024 & echo %%a %gb% GB
Wasif
  • 7,984
  • 2
  • 19
  • 32