本帖最后由 WHY 于 2016-1-20 10:06 编辑
可以在数字前面补上足够多的零,然后以字符串的方式比较- @echo off
- set "zero=00000000000000000000"
- set "size=%zero%2147483648"
- for /f %%a in ('wmic LogicalDisk where "DeviceID='C:'" get FreeSpace^|findstr [0-9]') do set "free=%zero%%%a"
-
- if "%free:~-20%" gtr "%size:~-20%" (
- echo 大于2GB
- ) else if "%free:~-20%" lss "%size:~-20%" (
- echo 小于2GB
- ) else (
- echo 等于2GB
- )
- pause
复制代码 也可以用vbs js powershell等等,举例:- $p = (Get-wmiObject -query "Select * from win32_LogicalDisk where DeviceID='C:'").FreeSpace
- if($p -gt 2147483648){"大于2GB"}elseif($p -lt 2147483648){"小于2GB"}else{"等于2GB"}
复制代码
|