Proper way of using UnrealBuildTool.exe from the command line?

I am trying to use this command from the command line (tweaked from what I see in the editor, with one option off):

“C:\Program Files\Unreal Engine\4.0\Engine\Binaries\DotNET\UnrealBuildTool.exe” MyProject5 -ModuleWithSuffix MyProject5 9024 Win64 Development -editorrecompile “C:\dev\Unreal\Projects\MyProject5\MyProject5.uproject”

I am getting these errors:

Could not parse Engine Version from ObjectVersion.cpp: Could not find a part of the path ‘C:\Program Files\Unreal Engine\4.0\Engine\Source\Runtime\Core\Private\UObject\ObjectVersion.cpp’.
ERROR: Couldn’t find module rules file for module ‘MCPP’.

What would be the correct command line?

You could make a batch file like this

call "C:\Program Files\Unreal Engine\4.0\Engine\Build\BatchFiles\Build.bat" MyProject5Editor Win64 Development "C:\dev\Unreal\Projects\MyProject5\MyProject5.uproject"
PAUSE

Btw, why does it look like you are building from what looks like a directory from the installed version of unreal 4? Did you drag and drop the github stuff directly into your unreal 4 install or something? I’m pretty sure that’s not how it’s supposed to be done.

I get the same error:

Could not parse Engine Version from ObjectVersion.cpp: Could not find a part of the path ‘C:\Program Files\Unreal Engine\4.0\Engine\Source\Runtime\Core\Private
UObject\ObjectVersion.cpp’.
ERROR: Couldn’t find module rules file for module ‘MCPP’.

The command line is pulled from the editor Output log (see attached)

As for the directory, it is where I installed the binary package, although I do have the sources elsewhere.

What exactly are you trying to do?
If your point was to compile the engine, editor, etc, then you shouldn’t be using the installed version for this.
This vid might be of some help. - YouTube

I am trying to compile a project without the -FailIfGeneratedCodeChanges flag from the command line using the binaries.

I’ve resolved my issue. Although not exactly what I was looking for I’ll accept the answer

This worked in my case:

"path\to\BatchFiles\Build.bat" "MyUProjectEditor" Win64 Development -WarningsAsErrors "path\to\MyUProject.uproject"

Note that you have to attach “Editor” suffix to first argument. The build.bat available in BatchFiles folder calles UnrealHeaderTool. Arguments must be in this exact order.