@ECHO OFF :: Check Windows version, command line arguments and availability of REG.EXE IF NOT "%OS%"=="Windows_NT" GOTO Syntax IF NOT "%~1"=="" GOTO Syntax REG.EXE /? >NUL 2>&1 || GOTO Syntax :: Keep variables local SETLOCAL :: Check Windows version IF NOT "%OS%"=="Windows_NT" GOTO End :: Abort if any command line argument was passed IF NOT "%~1"=="" GOTO End :: Define log file and directory here SET LogFile=\\ourserver\data\logs\IEVer.log SET LogFile=IEVer.log :: Check today's date FOR /F "tokens=2-4* delims=- " %%A IN ('DATE/T') DO SET CurDate=%%C%%B%%A :: Read IE version from registry and store it in a variable FOR /F "tokens=1*" %%A IN ('REG.EXE QUERY "HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\Version" 2^>NUL ^| FIND "REG_SZ"') DO FOR %%C IN (%%B) DO SET IEVer=%%C FOR /F "tokens=2*" %%A IN ('REG.EXE QUERY "HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer" /V "Version" 2^>NUL ^| FIND "REG_SZ"') DO SET IEVer=%%B IF "%IEVer%"=="" GOTO End :: Display result > CON ECHO. > CON ECHO %ComputerName% %CurDate% %UserName% %IEVer% :: Check if a log entry for this computer was made already today IF NOT EXIST %LogFile% GOTO Log TYPE %LogFile% | FIND "%ComputerName% %CurDate%" >NUL IF NOT ERRORLEVEL 1 GOTO End :: Log result :Log IF NOT EXIST %LogFile% ( > %LogFile% ECHO Computer Date User IE version ) >> %LogFile% ECHO %ComputerName% %CurDate% %UserName% %IEVer% :: End program :End ENDLOCAL GOTO:EOF :Syntax > CON ECHO. > CON ECHO IEVer.bat, Version 3.00 for Windows NT 4 and later > CON ECHO Logs Internet Explorer version (only once each day) > CON ECHO. > CON ECHO Usage: IEVER > CON ECHO. > CON ECHO Note: Requires REG.EXE, native in Windows 2000 and later, > CON ECHO or available in the Windows NT 4 Resource Kits > CON ECHO. > CON ECHO Written by Rob van der Woude > CON ECHO http://www.robvanderwoude.com IF NOT "%OS%"=="Windows_NT" COLOR 00