1

I want the output value of this command :

wmic logicaldisk where "DeviceID='C:'" get FreeSpace

to be assigned to a variable which I can use in an IF condition.

Ross Ridge
  • 38,414
  • 7
  • 81
  • 112
user2473819
  • 11
  • 1
  • 2
  • look [here](http://stackoverflow.com/q/14690230/2098699) and [here](http://stackoverflow.com/q/2539262/2098699) and [here](http://stackoverflow.com/a/13109266/2098699) – Endoro Jun 11 '13 at 09:33
  • possible duplicate of [How to get integer of free disk space in Batch file?](http://stackoverflow.com/questions/13106997/how-to-get-integer-of-free-disk-space-in-batch-file) – Endoro Jun 11 '13 at 09:34
  • didn't know, `wmic` will run on DOS... – Stephan Sep 22 '15 at 08:46

1 Answers1

2
@echo off
for /f "skip=1" %%a in ('wmic logicaldisk where "DeviceID='C:'" get FreeSpace') do if not defined var set var=%%a
echo %var%
foxidrive
  • 40,353
  • 10
  • 53
  • 68