How do I define ScriptDefines from either the command line or with executeScript

How do I add ScriptDefines for

#ifdef NAMEOFDEFINE 
<code A>
#else
<code B>
#endif

when building from the command line or by using ExecuteScript? I need this for my CI setup.

A little late to the party, but I want to leave the answer, should someone else stumble upon this.
Create a file csc.rsp in the root of your Asset folder, inject the line:

-define:YOUR_DEFINITION;ANOTHER_DEFINITION;

Delete it or whatever you want to do with it after compiling. The csc.rsp file will setup the defines properly before Unity builds.

See:

For more details.

Scripting define symbols can be set in playersettings.
In a build script you could use this:

Is this what you mean?