@echo off
chcp 1252 >nul
REM ============================================================
REM  FlyRemote - Corrigir icones no Windows
REM  Recria os atalhos, limpa o cache de icones do Windows e
REM  reinicia o Explorer. Use se os icones novos nao aparecerem.
REM  (A barra de tarefas vai piscar por 1 segundo - e normal.)
REM ============================================================

echo Recriando atalhos na area de trabalho...
powershell -NoProfile -Command ^
  "$ws=New-Object -ComObject WScript.Shell;" ^
  "$d=[Environment]::GetFolderPath('CommonDesktopDirectory');" ^
  "Remove-Item \"$d\FlyRemote Client.lnk\" -ErrorAction SilentlyContinue;" ^
  "foreach($a in @(@('FlyRemote','flyremote-client.exe'),@('FlyRemote Server','flyremote-server.exe'),@('FlyRemote Updater','flyremote-updater.exe'))){" ^
  "  $s=$ws.CreateShortcut(\"$d\$($a[0]).lnk\");" ^
  "  $s.TargetPath=\"C:\FlyRemote\$($a[1])\";" ^
  "  $s.WorkingDirectory='C:\FlyRemote';" ^
  "  $s.Save() }"

echo Limpando o cache de icones...
taskkill /f /im explorer.exe >nul 2>&1
del /a /q "%LocalAppData%\IconCache.db" >nul 2>&1
del /a /q "%LocalAppData%\Microsoft\Windows\Explorer\iconcache*.db" >nul 2>&1
ie4uinit.exe -show >nul 2>&1

echo Reiniciando o Explorer...
start explorer.exe

echo.
echo Pronto! Os icones novos devem aparecer agora.
timeout /t 3 >nul
