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

**URL:** <https://forums.unrealengine.com/t/ubt-compile-command-running-from-c-doesnt-produce-same-results-as-command-line/391743>\
**Category:** C++\
**Tags:** compiling, compilation-error, win64, unreal-engine, question, CPP\
**Created:** [April 24, 2017, 2:48am UTC](https://forums.unrealengine.com/t/ubt-compile-command-running-from-c-doesnt-produce-same-results-as-command-line/391743 "2017-04-24T02:48:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_d4efcd70](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_d4efcd70](https://forums.unrealengine.com/u/anonymous_user_d4efcd70)\
**Post date:** [April 24, 2017, 2:48am UTC](https://forums.unrealengine.com/t/ubt-compile-command-running-from-c-doesnt-produce-same-results-as-command-line/391743/1 "2017-04-24T02:48:41Z")

</div>

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.
