@echo off
cd /d "%~dp0"
set "SRC=%USERPROFILE%\Desktop\what-to-watch.html"
if exist "..\what-to-watch.html" set "SRC=%~dp0..\what-to-watch.html"
if exist "%SRC%" (
  copy /Y "%SRC%" "%~dp0index.html" >nul
  del "%SRC%"
  powershell -NoProfile -Command "(Get-Content -LiteralPath '%~dp0index.html' -Raw).Replace('what-to-watch/config.js','config.js') | Set-Content -LiteralPath '%~dp0index.html' -Encoding utf8 -NoNewline"
  echo App moved into this folder as index.html
) else if not exist "%~dp0index.html" (
  echo Could not find what-to-watch.html on Desktop.
  echo Put the app HTML in this folder and name it index.html
  pause
  exit /b 1
)
start "" "%~dp0index.html"
