|
发表于 2023-8-25 10:01:40
|
显示全部楼层
本帖最后由 holley2008 于 2023-8-25 10:46 编辑
第一次使用wevtuttl,稍微看了下,WEVTUTIL gli可以获取日志创建日期,接下来就是日期格式化和判断时间范围,头疼,没继续折腾了。- @echo off&setlocal enableextensions enabledelayedexpansion
- for /f "delims=" %%a in ('WEVTUTIL EL') do (
- set rizhi=%%a
- set firstLine=1
- for /f "delims=: tokens=2" %%i in ('WEVTUTIL gli "!rizhi!"') do (
- if !firstLine!==1 (
- set shijian=%%i
- set ttt=!shijian:~1,4!!shijian:~6,2!!shijian:~9,2!
- set tttt=%date:~0,4%%date:~5,2%%date:~8,2%
- set /a xxxx=tttt-ttt
- echo,!xxxx!
- )
- set firstLine=0
- )
- pause
- )
- endlocal
- pause
复制代码
|
|