@echo off
setlocal enableextensions

if not "%CLOUDSCRIPTS_REDIRECTED%"=="1" if exist "%LOCALAPPDATA%\cloudscripts\client\bin\cloudscripts.cmd" (
  set CLOUDSCRIPTS_REDIRECTED=1
  "%LOCALAPPDATA%\cloudscripts\client\bin\cloudscripts.cmd" %*
  goto:EOF
)

if not defined CLOUDSCRIPTS_BINPATH set CLOUDSCRIPTS_BINPATH="%~dp0cloudscripts.cmd"

if exist "%~dp0..\bin\node.exe" (
  "%~dp0..\bin\node.exe"  "%~dp0..\bin\run" %*
) else if exist "%LOCALAPPDATA%\oclif\node\node-24.14.1.exe" (
  "%LOCALAPPDATA%\oclif\node\node-24.14.1.exe"  "%~dp0..\bin\run" %*
) else (
  node  "%~dp0..\bin\run" %*
)
