UBT compile command running from C++ doesn't produce same results as command line

I’m using CreateProcess to run UBT whenever my game documentation code generator generates new C++ files. I’m passing in the path to UBT, and the argument string to CreateProcess. Generating the build files works without issue with the command, \Path\to\UnrealBuildTool.exe Win64 Development -ProjectFiles -Project="\path\to\project.uproject" -game -engine

Running the build command doesn’t appear to be working from C++. \path\to\UnrealBuildTool.exe ProjectEditor Win64 Development \path\to\project.uproject -waitmutex -Deploy The same command string works perfectly fine from any directory in the command prompt. I even tried putting Sleep in between generating updated ProjectFiles for UBT, and compilation in case something wasn’t finished being generated when the build command executes. Are there any additional arguments I would have to pass in if not running UBT through the command prompt? Can I just use NMake directly?

EDIT: I was able to fix the issue by adding a space to the start of the argument string used by CreateProcess is there any means of avoiding that? It feels like Windows should be able to interpret the command without that space being at the start.