@echo off
rem Registers the agent to start automatically (hidden) when you log in.
set SCRIPT_DIR=%~dp0
powershell -NoProfile -Command "$ws = New-Object -ComObject WScript.Shell; $sc = $ws.CreateShortcut([Environment]::GetFolderPath('Startup') + '\PrinterOnlineAgent.lnk'); $sc.TargetPath = '%SCRIPT_DIR%start-hidden.vbs'; $sc.WorkingDirectory = '%SCRIPT_DIR%'; $sc.Save()"
if %errorlevel%==0 (
  echo.
  echo [OK] Agent will now start automatically at logon.
  echo Starting agent now...
  start "" wscript "%SCRIPT_DIR%start-hidden.vbs"
) else (
  echo [FAILED] Could not create startup shortcut.
)
pause
