本帖最后由 holley 于 2023-12-26 16:00 编辑
回复 1# 2275385864
你这个获取到的不是安装日期嘛??只是最近一次的启动时间嘛。- @echo off
- for /f "skip=1 tokens=*" %%a in ('wmic OS GET InstallDate') do (
- set InstallDate=%%a
- goto :next
- )
- :next
- set InstallDate=%InstallDate:~2,12%
- echo %InstallDate%
- pause
复制代码 改成systeminfo试了一下:- @echo off
- for /f "tokens=2,3* delims=:" %%a in ('systeminfo ^| findstr /c:"初始安装日期"') do set "InstallDateTime=%%a%%b%%c"
- set "InstallDateTime=%InstallDateTime: =%"
- set "InstallDateTime=%InstallDateTime:/=%"
- set "InstallDateTime=%InstallDateTime:,=%"
- set "InstallDateTime=%InstallDateTime:~2,13%"
- echo %InstallDateTime%
-
- pause
复制代码
|