@Echo Off

set log_path="%~dp0nxlog_kaynaklari.txt"

reg query HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\nxlog /v *installdir*

if %ERRORLEVEL% EQU 1 goto nxlogkur

if %ERRORLEVEL% EQU 0 goto exit

:nxlogkur
cmd /c Msiexec /X "%~dp0nxlogv2.msi" /qn
@RD /S /Q "C:\Program Files (x86)\nxlog"
cmd /c Msiexec /I "%~dp0nxlog.msi" /qn
cmd /c copy /Y "%~dp0nxlog.conf" "C:\Program Files\nxlog\conf"
cmd /c sc config nxlog start= delayed-auto
cmd /c net stop nxlog
cmd /c net start nxlog

for /f "tokens=2 delims=:" %%a in ('ipconfig^|find "IPv4 Address"') do (
set ip=%%a
goto :BREAK
)

:BREAK
echo %ip: =% >> %log_path%
cmd /c hostname.exe >> %log_path%
echo ___________________________________________________________________________  >> %log_path%
goto:eof

:exit
cmd /c net start nxlog
goto:eof