@echo off
 echo "The Program Wipe all CDC Files from the console including Project Files"
 
 echo "Killing Processes"
 Taskkill /IM Etype_AudioRack.exe /F
 Taskkill /IM Etype_MainSurface.exe /F
 Taskkill /IM ConsoleLauncher.exe /F
 Taskkill /IM Etype_AutoSurface.exe /F
 Taskkill /IM Etype_centresurface.exe /F
 Taskkill /IM cdc8upgrader.exe /F
 Taskkill /IM Etype_SamSurface.exe /F

echo "Cleaning up"
lodctr /r
echo "Cleaned UP"
sc config "TabletInputService" start= disabled
sc stop "TabletInputService" 
timeout /t 4
sc config "Tftpd32_svc" start= auto
sc start "Tftpd32_svc" 
timeout /t 4
wmic path Win32_UserAccount set PasswordExpires=False
timeout /t 4
sc config "SNMP" start= disabled
sc config "SNMPTRAP" start= disabled
timeout /t 2
SC Config "Sysmain" Start= Disabled
timeout /t 2
SC Stop "Sysmain" 
timeout /t 2

echo "........................................... Virtual memory fix............................"
wmic computersystem where name="%computername%" set AutomaticManagedPagefile=True
echo "........................................... Done memory fix............................"

reg add "HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\Etype_audiorack.exe" /f  /v DumpType /t REG_DWORD /d 2
reg add "HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\Etype_surface.exe" /f /v DumpType /t REG_DWORD /d 2
reg add "HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\Etype_centresurface.exe" /f /v DumpType /t REG_DWORD /d 2
reg add "HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\Etype_samsurface.exe" /f /v DumpType /t REG_DWORD /d 2
reg add "HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\Etype_autosurface.exe" /f /v DumpType /t REG_DWORD /d 2
reg add "HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\Etype_mainsurface.exe" /f /v DumpType /t REG_DWORD /d 2


reg add "HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\Etype_audiorack.exe" /f /v DumpFolder /t REG_EXPAND_SZ /d "C:\CDC_Dump"
reg add "HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\Etype_surface.exe" /f /v DumpFolder /t REG_EXPAND_SZ /d "C:\CDC_Dump"
reg add "HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\Etype_centresurface.exe" /f /v DumpFolder /t REG_EXPAND_SZ /d "C:\CDC_Dump"
reg add "HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\Etype_samsurface.exe" /f /v DumpFolder /t REG_EXPAND_SZ /d "C:\CDC_Dump"
reg add "HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\Etype_autosurface.exe" /f /v DumpFolder /t REG_EXPAND_SZ /d "C:\CDC_Dump"
reg add "HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\Etype_mainsurface.exe" /f /v DumpFolder /t REG_EXPAND_SZ /d "C:\CDC_Dump"

reg add "HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\Etype_audiorack.exe" /f /v DumpCount /t REG_DWORD /d 4
reg add "HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\Etype_surface.exe" /f /v DumpCount /t REG_DWORD /d 4
reg add "HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\Etype_centresurface.exe" /f /v DumpCount /t REG_DWORD /d 4
reg add "HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\Etype_samsurface.exe" /f /v DumpCount /t REG_DWORD /d 4
reg add "HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\Etype_autosurface.exe" /f /v DumpCount /t REG_DWORD /d 4
reg add "HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\Etype_mainsurface.exe" /f /v DumpCount /t REG_DWORD /d 4

REG DELETE HKCU\Cadac /f
REG DELETE HKCU\CDC8_ConsoleData /f
REG DELETE HKCU\CDC_Hardware /f
REG DELETE HKCU\CDC_ConsoleData /f



Rmdir C:\Cadac /s /q
Rmdir C:\CadacUserSettings /s /q
Rmdir C:\Launcher /s /q
Rmdir C:\CDC8 /s /q
Rmdir C:\CDC8-TEMP /s /q
Rmdir C:\DspData /s /q
Rmdir C:\templogs /s /q
Rmdir C:\CDC_Dump /s /q
Rmdir C:\Users\ecomixer\AppData\Local\Cadac_Holdings_LTD /s /q
Rmdir C:\Users\ecomixer\AppData\Local\SCC_Audio_Limited_(Cadac_ /s /q
Rmdir C:\Users\ecomixer\AppData\Local\SCC_Audio_Limited_Cadac /s /q
mkdir "C:\CDC_Dump"

Set src=%~d0
echo Now Reinstalling System from USB Key %src%
timeout /t 5
xcopy  %src%\Launcher C:\Launcher /s /i /e /y
echo
echo Copy Done
echo
echo **************************************************************
echo *                                                            * 
echo *              REMOVE USB KEY AFTER SHUTDOWN                 *
echo *                                                            *
echo **************************************************************
timeout /t 5
shutdown /r /t 0
 
  
