menu
The CLI version of D2S2 is available to users with a Developer license. It performs all the same simulation calculations as the standard application but without the overhead of rendering the simulation graphics, making it significantly faster to execute.
The CLI is well suited to scenarios where a graphical interface is not required or practical:

D2S2.exe login
D2S2.exe <task> <task parameters>
Sign in once with login (see Signing in); later tasks use that sign-in. Running the CLI application without any arguments displays the built-in help message.
runsimRuns a simulation from a provided scenario file.
| Parameter | Required | Description |
|---|---|---|
--scenario <file> |
Yes | Path to the scenario file (.d2s2) |
--useropts <file> |
No | Path to the user settings file |
Example:
D2S2.exe runsim --scenario c:\temp\scenario.d2s2 --useropts c:\temp\useropts.xml
runscriptRuns a scenario in conjunction with a script. Either --scriptname or --scriptopts must be specified.
| Parameter | Required | Description |
|---|---|---|
--scriptname <name> |
Yes* | Fully qualified type name of the script to run. Use the list task to see available names. |
--scriptopts <file> |
Yes* | Path to a script options file (.d2s2-script). Can be used instead of --scriptname. |
--scenario <file> |
No | Path to the scenario file (.d2s2) |
--useropts <file> |
No | Path to the user settings file |
*At least one of --scriptname or --scriptopts is required.
Examples:
D2S2.exe runscript --scriptname D2S2.Simulation.LoggingScript
D2S2.exe runscript --scriptopts c:\temp\options.d2s2-script --scenario c:\temp\scenario.d2s2 --useropts c:\temp\useropts.xml
listLists all available scripts by their fully qualified type names. Use these names with the --scriptname parameter of runscript and makescript.
D2S2.exe list
makescriptSaves a template script options file (.d2s2-script) with default options for the named script. Use this as a starting point before customising and passing the file to runscript.
| Parameter | Required | Description |
|---|---|---|
--scriptname <name> |
Yes | Fully qualified type name of the script. Use the list task to see available names. |
--scriptopts <file> |
Yes | Output path for the generated script options file |
--useropts <file> |
No | Path to the user settings file |
Example:
D2S2.exe makescript --scriptname D2S2.Simulation.LoggingScript --scriptopts c:\temp\options.d2s2-script
If your company has cloud simulations enabled, the CLI can run a script on the D2S2 cloud simulation service instead of on your machine. You don't need a licence or plugins locally: each cloud run uses the newest released plugins. Sign in once with D2S2 login. If you signed in before cloud simulations were available, sign in again. A service account (D2S2_CLIENT_ID and D2S2_CLIENT_SECRET) needs the d2s2.sim scope.
D2S2 cloud submit --scenario scenario.d2s2 --scriptopts options.d2s2-script [--useropts usersettings.xml]
[--file data/tle.txt] [--label "gain 0.4"] [--cpu 0.5|1|2|4] [--timeout <minutes>]
[--wait [--out <folder>] [--zip]]
D2S2 cloud submit --batch sweep.json [--label <text>] [--wait [--out <folder>] [--zip]]
D2S2 cloud status [<run or batch>]
D2S2 cloud log <run> [--tail <KiB>]
D2S2 cloud results <run or batch> [--out <folder>] [--zip]
D2S2 cloud cancel <run or batch>
D2S2 cloud rerun <run> [--wait [--out <folder>] [--zip]]
D2S2 cloud entitlement
submit uploads the scenario, the settings and any other files (only the ones not already stored for your company) and queues the run. --file adds a file the scenario needs: a relative path such as data/tle.txt keeps its folder in the run's folder; otherwise only the file name is used.
--wait makes submit work like runscript. It shows the run's log as the run progresses, then downloads the output files into --out and checks them. The default folder is named after the run. The exit code is:
0: the run succeeded;2: the service failed the run;3: the run reached its time limit;4: the run was cancelled;1: an error, such as a wrong option or a sign-in problem;130: you stopped waiting with Ctrl+C. The run carries on.Without --wait, submit prints the run's id. Use status, log and results to follow the run and download its output later.
Batches run several scenarios or settings in one go, such as a parameter sweep. The batch file is JSON, with paths relative to the file. Settings in defaults apply to every run, and a run's own settings override them. A run's files are added to the default files.
{
"label": "detumble sweep",
"defaults": { "scriptOptions": "detumble.d2s2-script", "userSettings": "usersettings.xml", "files": ["data/tle.txt"] },
"runs": [
{ "label": "gain 0.4", "scenario": "gain-0.4.d2s2" },
{ "label": "gain 0.6", "scenario": "gain-0.6.d2s2", "cpu": 2, "timeoutMinutes": 120 }
]
}
A run can set scenario, scriptOptions (or scriptName), userSettings, files, cpu, timeoutMinutes and label. Each file is uploaded once, however many runs use it.
submit --batch with --wait shows a line as each run ends. It then downloads each run into its own folder under --out, named after the run's label (or the run's id, when labels are missing or repeated). It also writes batch.json, listing each run's state, exit code and folder. It exits with 0 if every run succeeded, else 5.
status, results and cancel take a run's id or a batch's id. rerun runs a finished run again with the same inputs, as part of the same batch, using the newest released plugins.
Labels appear in run lists and to administrators, so don't put mission or customer names in them.
Each run gets 2 GiB of memory per vCPU (--cpu, default 1). The time limit (--timeout) is 60 minutes by default. D2S2 cloud entitlement shows your company's limits.
The CLI uses the first of these that applies:
| Method | How | Best for |
|---|---|---|
| E-mail and password | --user <e-mail>, with the password from --pwd-stdin (read from standard input), the D2S2_PASSWORD environment variable, or --pwd <password> |
Accounts that can't use login |
| Service account | The D2S2_CLIENT_ID and D2S2_CLIENT_SECRET environment variables |
CI/CD pipelines and test servers |
Session from login |
D2S2.exe login once; later tasks need no sign-in options |
Your own machine (recommended) |
| Last application sign-in | Nothing: the CLI uses the sign-in of the D2S2 application on the same computer | Occasional use next to the application |
login shows a link and a code. Open the link in any browser, on this computer or another device such as your phone, sign in as you do on the D2S2 website, and enter the code. The CLI keeps a session, not your password. The session stays valid until you run D2S2.exe logout, or until it hasn't been used for 30 days.
--browser opens this computer's browser instead of showing a code.--mission <mission> is for accounts that sign in to a mission.Service accounts sign in a CI/CD pipeline or test server without a person's account. Each one belongs to your company and uses its licence. Ask D2S2 support for one. Keep its secret in your CI system's secret store, never in scripts or source control.
Without a connection, a CLI signed in with login (or through the application) uses the licence from its last sign-in, until that licence expires.
Security note: don't pass
--pwdon the command line. Other processes on the computer can see it, and it stays in your shell history. Uselogin,--pwd-stdinorD2S2_PASSWORDinstead.
Script parameters — such as the output path for the Logging script — are configured via a script options file (.d2s2-script). See Scripts for instructions on generating a script options file using the makescript task.
The script options file is a JSON document where each field corresponds to a configurable property of the selected script. The following example shows a typical options file for the built-in LoggingScript:
{
"$type": "D2S2.Simulation.LoggingScript, D2S2Library",
"CsvFilename": "C:/temp/Logger.csv",
"SaveObjects": "ExampleSat CubeComputer",
"StateSaveInterval": 1,
"UpdateVisual": false,
"SaveStateHistory": false,
"ScriptResult": false
}
| Field | Description |
|---|---|
$type |
Fully qualified type name of the script. This must match the name returned by the list task. |
CsvFilename |
Output path for the generated CSV log file. |
SaveObjects |
Space-separated list of simulation object names whose state will be logged. |
StateSaveInterval |
Interval (in simulation seconds) at which state is recorded. |
UpdateVisual |
When true, updates the visual state of objects during logging. Set to false for headless/CLI use. |
SaveStateHistory |
When true, retains the full state history in memory during the run. |
ScriptResult |
Reserved for script result reporting. Typically set to false. |
User code directories are configured in the user settings file (.xml), which controls where D2S2 looks for custom scripts and components at startup. This file is generated when developer options are configured — see Developer User Settings for details. The file is located in the D2S2 installation directory, typically AppData\Roaming\D2S2.
An example user settings file is shown below:
<UserSettings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<LastEulaAcceptedVer>1</LastEulaAcceptedVer>
<DeveloperLocations>
<string>C:/temp/Source</string>
</DeveloperLocations>
<ShowUpdateInfo>false</ShowUpdateInfo>
<DeveloperIncludeVis>true</DeveloperIncludeVis>
<DeveloperIncludeWinForms>true</DeveloperIncludeWinForms>
<OptimiseUserCode>false</OptimiseUserCode>
</UserSettings>
| Field | Description |
|---|---|
DeveloperLocations |
List of directories to scan for user-authored scripts and components. Add one <string> entry per directory. |
DeveloperIncludeVis |
When true, includes WPF/visual assemblies when compiling user code. Set to false for pure CLI use to reduce compilation overhead. |
DeveloperIncludeWinForms |
When true, includes WinForms assemblies when compiling user code. Set to false if your scripts do not use WinForms UI components. |
OptimiseUserCode |
When true, compiles user code with optimisations enabled. Useful for performance-sensitive scripts in production runs. |