echo off

echo Starting Uninstallation of 1.0...  Time = %time% %date% >> ../../log/legacyremoval.log

reg Query "HKLM\Hardware\Description\System\CentralProcessor\0" | find /i "x86" > NUL && set OS=32BIT || set OS=64BIT

IF %OS%==64BIT (
    echo getting 64bit SAAZOD Installation Path >> ../../log/legacyremoval.log
    FOR /F "skip=2 tokens=2,*" %%A IN ('reg.exe query "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\SAAZOD" /v "Installationpath"') DO set "DFMT=%%B"
) ELSE (
    echo getting 32bit SAAZOD Installation Path >> ../../log/legacyremoval.log
    FOR /F "skip=2 tokens=2,*" %%A IN ('reg.exe query "HKEY_LOCAL_MACHINE\SOFTWARE\SAAZOD" /v "Installationpath"') DO set "DFMT=%%B" 
)

echo InstallationPath:  %DFMT% >> ../../log/legacyremoval.log

echo Running "%DFMT%Uninstall\uninstall.exe" /u:"%DFMT%Uninstall\uninstall.xml" /S >>  ../../log/legacyremoval.log

"%DFMT%Uninstall\uninstall.exe" /u:"%DFMT%Uninstall\uninstall.xml" /S

echo Invoked Uninstallation of 1.0...  Time = %time% %date% >> ../../log/legacyremoval.log
