Last active
December 21, 2016 15:14
-
-
Save theeye-io/83e24f44ce5809b94074dfb546975218 to your computer and use it in GitHub Desktop.
checkDriveFreeSpaceWMIC.bat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rem compatible from windows version 2003. Ejemplo C:,3000000 (bytes) | |
@echo off | |
set drive=%1 | |
shift | |
set threshold=%1 | |
shift | |
rem woooojojojo! todo esto solo para obtener el espacio libre . | |
for /f "usebackq delims== tokens=2" %%x in (`wmic logicaldisk where "DeviceID='%drive%'" get FreeSpace /format:value`) do set FreeSpace=%%x | |
echo Free space in drive is %FreeSpace% , threshold %threshold% | |
IF %FreeSpace% GEQ %threshold% ( | |
echo Free space %FreeSpace% is fine | |
echo success | |
) ELSE ( | |
echo Free space %FreeSpace% is running low | |
echo failure | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment