rem *** Author: T. Wittrock, RZ Uni Kiel ***

if "%WSUS_LOGFILE%"=="" set WSUS_LOGFILE=%SystemRoot%\ctupdate.log

if "%REG_PATH%"=="" goto NoRegPath

echo Registering log file display...
%REG_PATH% ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce /v WSUSOfflineUpdateLogFile /t REG_SZ /d "%SystemRoot%\notepad.exe %WSUS_LOGFILE%"
if errorlevel 1 goto RegError
echo %DATE% %TIME% - Info: Registered log file display >> %WSUS_LOGFILE%
goto EoF

:NoRegPath
echo ERROR: Environment variable REG_PATH not set.
echo %DATE% %TIME% - Error: Environment variable REG_PATH not set >> %WSUS_LOGFILE%
goto Error

:RegError
echo Warning: Registration of log file display failed.
echo %DATE% %TIME% - Warning: Registration of log file display failed >> %WSUS_LOGFILE%
goto EoF

:Error
exit /b 1

:EoF
