none
cmd line bat script not working as expected

    Question

  • HI,

    I have the following script that checks if the free disk space is bigger than a certain value:

    for /f "usebackq delims== tokens=2" %x in (`wmic logicaldisk where "DeviceID='C:'" get FreeSpace /format:value`) do set FreeSpace=%x

    if %FreeSpace% GTR 30000000 ECHO "ENOUGH"

    the script is setting the FreeSpace variable but is not giving the correct result for the greater than check

    What am I doing wrong, is the value too large, does it need to be changed  to GB format and then checked ?

    Dani

    Thursday, November 1, 2018 2:51 PM