Problem with compiling code via .bat script


I have created simple .bat script for regenerating binary biles for my project using UBT (Engine\Build\BatchFiles\Rebuild.bat) instead of Visual Studio. The problem is when I try to use it (simply run via double clicking .bat script), I get code errors which does not exist when I compile normally from within Visual Studio.

Do I miss something? Does Visual Studio solution compilation involves more modules or sth else more than UBT compilation does?
Script is meant to generate binary files for project locally (without visual Studio) to avoid submitting binary files to perforce server manually

I use: “C:\Program Files\Epic Games\UE_4.16\Engine\Build\BatchFiles\Rebuild.bat” ProjectNameEditor Win64 Development Editor “%~dp0\ProjectName.uproject” -waitmutex /k" command in my script

Here is full script:

@eCHo off
echo ==================================================
echo Manual binaries rebuilding script, done by Xter
echo ==================================================

"C:\Program Files\Epic Games\UE_4.16\Engine\Build\BatchFiles\Rebuild.bat" ProjectNameEditor Win64 Development Editor "%~dp0\ProjectName.uproject" -waitmutex /k
IF ERRORLEVEL 0 echo Build success
IF NOT ERRORLEVEL 0 echo Build failed
pause >nul

Thanks in advance,