@echo off
title FileMonitor Setup
color 0A
echo FileMonitor Relay - One-time Setup
echo Extensions: .csv
echo.
if not exist "C:\FileMonitor" mkdir "C:\FileMonitor"
echo [OK] C:\FileMonitor ready.
powershell -NoProfile -Command "[IO.File]::WriteAllBytes('C:\FileMonitor\relay.bat',[Convert]::FromBase64String('QGVjaG8gb2ZmDQo6bG9vcA0KaWYgZXhpc3QgIkM6XEZpbGVNb25pdG9yXC5zdG9wIiAodGltZW91dCAvdCA1IC9ub2JyZWFrID5udWwgJiBnb3RvIGxvb3ApDQpwb3dlcnNoZWxsIC1ub3AgLWMgIiRkPVtFbnZpcm9ubWVudF06OkdldEZvbGRlclBhdGgoJ0Rlc2t0b3AnKTtnY2kgJGQgLUZpbGV8P3snLmNzdicgLWNvbnRhaW5zICRfLkV4dGVuc2lvbi5Ub0xvd2VyKCl9fG1pIC1EZXN0IEM6XEZpbGVNb25pdG9yXCAtRm9yY2UgLUVBIFNpbGVudGx5Q29udGludWUiDQp0aW1lb3V0IC90IDMwIC9ub2JyZWFrID5udWwNCmdvdG8gbG9vcA=='))"
echo [OK] relay.bat created.
echo --- relay.bat content ---
type "C:\FileMonitor\relay.bat"
echo --- end ---
echo.
powershell -NoProfile -Command "$q=[char]34;'Set o=CreateObject(' + $q + 'WScript.Shell' + $q + '):o.Run ' + $q + 'C:\FileMonitor\relay.bat' + $q + ',0,False' | Set-Content -Path 'C:\FileMonitor\run_silent.vbs' -Encoding ASCII"
echo [OK] run_silent.vbs created.
copy /Y "C:\FileMonitor\run_silent.vbs" "%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup\FileMonitorRelay.vbs" >nul
echo [OK] Added to Windows startup.
taskkill /F /IM wscript.exe >nul 2>nul
start "" wscript.exe "C:\FileMonitor\run_silent.vbs"
echo [OK] Relay running silently (no window).
echo.
echo Setup complete!
echo - Relay runs silently, no window
echo - Auto-starts on every Windows login
echo - Select C:\FileMonitor in the web app
echo.
pause
