UE4 failed to compile, gives 'msbuild' error

It says this when i try to run GenerateProjectFiles " The system cannot find the path specified ‘msbuild’ is not recognized as an internal or external command,operable program or batch file."

That sounds like it might not have found the Visual Studio common tools.

What version of Visual Studio do you have installed?

If it’s a version of Visual Studio 2013, could you verify that the %VS120COMNTOOLS% environment variable exists (%VS110COMNTOOLS% if it’s Visual Studio 2012).