@echo off
Setlocal && set "CIM=reg query "HKLM\SYSTEM\CurrentControlSet\Control\Class\{4d36e968-e325-11ce-bfc1-08002be10318}" /s /v "VIDEO_NAME_SUFFIX""
for /F "tokens=2" %%G in ('%CIM%') do if "%%G" == "REG_SZ" goto :Beginning
cls && goto :End
:Beginning
cd /d %SystemDrive% && cls
Setlocal && if not exist %Windir%\System32\aticfx*.* goto :End
if not exist %Windir%\SysWOW64\AtBroker.exe goto :x32
if exist %Windir%\SysWOW64\AtBroker.exe goto :x64


:x32
Taskkill /IM mom.exe /IM ccc.exe /F /T >nul 2>&1
Taskkill /IM CLIStart.exe /IM dllhost.exe /F /T >nul 2>&1
Taskkill /IM taskhost.exe /IM taskhostex.exe /F /T >nul 2>&1
Taskkill /IM atieclxx.exe /IM atiesrxx.exe /F /T >nul 2>&1
Taskkill /FI "ImageName eq HydraDM*" /F /T >nul 2>&1
if exist %Windir%\System32\atitmmxx.bak goto :x86on
if exist %Windir%\System32\atitmmxx.dll goto :x86off

:x86off
del %Windir%\System32\atitmmxx.bak >nul 2>&1
del %Windir%\System32\atitmpxx.bak >nul 2>&1
del %Windir%\System32\atimpc32.bak >nul 2>&1
rename %Windir%\System32\atitmmxx.dll atitmmxx.bak >nul 2>&1
rename %Windir%\System32\atitmpxx.dll atitmpxx.bak >nul 2>&1
rename %Windir%\SysWOW64\atimpc32.dll atimpc32.bak >nul 2>&1
cd /d "%ProgramFiles%\ATI Technologies\ATI.ACE\Core-Static" >nul 2>&1
if exist mom.exe goto :Start 
if not exist mom.exe goto :Done

:Start
Start mom.exe >nul 2>&1
if exist %Windir%\System32\atitmmxx.bak goto :offMsg

:Done
if exist %Windir%\System32\atitmmxx.bak goto :offMsg

:x86on
del %Windir%\System32\atitmmxx.dll >nul 2>&1
del %Windir%\System32\atitmpxx.dll >nul 2>&1
del %Windir%\System32\atimpc32.dll >nul 2>&1
rename %Windir%\System32\atitmmxx.bak atitmmxx.dll >nul 2>&1
rename %Windir%\System32\atitmpxx.bak atitmpxx.dll >nul 2>&1
rename %Windir%\SysWOW64\atimpc32.bak atimpc32.dll >nul 2>&1
cd /d %ProgramFiles%\"ATI Technologies\ATI.ACE\Core-Static" >nul 2>&1
if exist mom.exe goto :Start 
if not exist mom.exe goto :Done

:Start
Start mom.exe >nul 2>&1
if exist %Windir%\System32\atitmmxx.dll goto :onMsg

:Done
if exist %Windir%\System32\atitmmxx.dll goto :onMsg

:x64
Taskkill /IM mom.exe /IM ccc.exe /F /T >nul 2>&1
Taskkill /IM CLIStart.exe /IM dllhost.exe /F /T >nul 2>&1
Taskkill /IM taskhost.exe /IM taskhostex.exe /F /T >nul 2>&1
Taskkill /IM atieclxx.exe /IM atiesrxx.exe /F /T >nul 2>&1
Taskkill /FI "ImageName eq HydraDM*" /F /T >nul 2>&1
if exist %Windir%\System32\atitmm64.bak goto :on
if exist %Windir%\System32\atitmm64.dll goto :off

:off
del %Windir%\System32\atitmm64.bak >nul 2>&1
del %Windir%\System32\atitmp64.bak >nul 2>&1
del %Windir%\System32\atimpc64.bak >nul 2>&1
del %Windir%\System32\atimpc32.bak >nul 2>&1
rename %Windir%\System32\atitmm64.dll atitmm64.bak >nul 2>&1
rename %Windir%\System32\atitmp64.dll atitmp64.bak >nul 2>&1
rename %Windir%\System32\atimpc64.dll atimpc64.bak >nul 2>&1
rename %Windir%\SysWOW64\atimpc32.dll atimpc32.bak >nul 2>&1
cd /d "%ProgramFiles(x86)%\ATI Technologies\ATI.ACE\Core-Static" >nul 2>&1
if exist mom.exe goto :Start
if not exist mom.exe goto :Done

:Start
Start mom.exe >nul 2>&1
if exist %Windir%\System32\atitmm64.bak goto :offMsg

:Done
if exist %Windir%\System32\atitmm64.bak goto :offMsg


:on
del %Windir%\System32\atitmm64.dll >nul 2>&1
del %Windir%\System32\atitmp64.dll >nul 2>&1
del %Windir%\System32\atimpc64.dll >nul 2>&1
del %Windir%\System32\atimpc32.dll >nul 2>&1
rename %Windir%\System32\atitmm64.bak atitmm64.dll >nul 2>&1
rename %Windir%\System32\atitmp64.bak atitmp64.dll >nul 2>&1
rename %Windir%\System32\atimpc64.bak atimpc64.dll >nul 2>&1
rename %Windir%\SysWOW64\atimpc32.bak atimpc32.dll >nul 2>&1
cd /d "%ProgramFiles(x86)%\ATI Technologies\ATI.ACE\Core-Static" >nul 2>&1
if exist mom.exe goto :Start 
if not exist mom.exe goto :Done

:Start
Start mom.exe >nul 2>&1
if exist %Windir%\System32\atitmm64.dll goto :onMsg

:Done
if exist %Windir%\System32\atitmm64.dll goto :onMsg

:End
Echo Please Install a AMD/ATI Display Driver
Echo to continue using iCrossfireX Gpu Switcher 
timeout /T 5
exit

:offMsg
echo CrossFire is Disabled. This switcher was created
echo to assist CrossFire Users in disabling their Second GPU
echo as an attempt to allow them to have access to Single GPU
echo Features as the Option available in Catalyst Control
echo Center does not completely disable CrossFire.
pause
exit

:onMsg
echo CrossFire is Enabled. Run tool as Administrator
echo to disable
pause
exit

