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?
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?
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