回复 1# tempasdf
Win7-v2.bat- @echo off
- for /f "tokens=2 delims=.=" %%a in ('wmic Path Win32_OperatingSystem get LastBootUpTime /value') do (
- set "BootTime=%%a"
- )
- set "BootTime=%BootTime:~0,4%-%BootTime:~4,2%-%BootTime:~6,2% %BootTime:~8,2%:%BootTime:~10,2%:%BootTime:~12,2%"
- for /f "tokens=2 delims=: " %%a in ('powershell "(Get-Date) - (Get-Date '%BootTime%')" ^|findstr /b "Days"') do (
- echo %%a
- if %%a geq 2 (
- echo 大于等于2天
- ) else (
- echo 小于2天
- )
- )
- pause
复制代码
|