Building UE4 from source [error MSB3073 The command "..\..\Build\BatchFiles\Build.bat DatasmithSDK ...." exited with code 6

The long answer

Since it’s a good exercise I’ll explain how I found the fix for learning purposes, may this story help you solve other issues.

At first the error does not tell you much, if you analyze it, it says some script Build\BatchFiles\Build.bat failed and exited with error code 6. It may not even be clear what are the arguments if you are unfamiliar with UE.

So you might take a look at “C:\UE\Engine\Build\BatchFiles\Build.bat” and see it executes UnrealBuildTool.exe which means it’s actually UnrealBuildTool.exe which is failing and returning error code 6. The documentation says nothing about the meaning of code 6 so you may remember UE has its own build tool then look around and find C:\UE\Engine\Programs\UnrealBuildTool\Log.txt which contains the details of the last execution of UnrealBuildTool.exe by the look of the file’s timestamp: