I first scripted WhenInstalled.bat in tip 8180.

I have now scripted InstallDate.bat to determine when Windows was installed.

The syntax for using InstallDate.bat is:

\[call\] InstallDate Dt Tm

Where:

Dt is a call directed environment variable that will contain the shortdate                                 when Windows was installed, like 05/03/2003.                              Tm is a call directed environment variable that will contain the time                                 when Windows was installed, like 11:05:59.
InstallDate.bat contains:
@echo off                              if \{%2\}==\{\} @echo Syntax: InstallDate Dt Tm&goto :EOF                              if exist "%TEMP%\InstallDate.vbs" goto doit                              @echo.Dim WshShell, wInstall >"%TEMP%\InstallDate.vbs"                              @echo.Set WshShell = WScript.CreateObject("WScript.Shell") >>"%TEMP%\InstallDate.vbs"                              @echo.wInstall = WshShell.RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\installdate") >>"%TEMP%\InstallDate.vbs"                              @echo.WScript.Echo DateAdd("s", wInstall, DateSerial(1970, 1, 1)) >>"%TEMP%\InstallDate.vbs"                              :doit                              for /f "Tokens=1,2" %%a in ('cscript //nologo "%TEMP%\InstallDate.vbs"') do (                               set %1=%%a                               set %2=%%b                              )