Command-Line Interface - CLI
PK-Sim provides a command-line interface for automation and batch processing. The current CLI supports four workflows:
running simulations from snapshot files with the
runcommand,converting PK-Sim projects and snapshots with the
snapcommand,exporting simulations from a project file with the
exportcommand,validating or executing qualification workflows with the
qualificationcommand.
The CLI returns exit code 0 when a command finishes successfully and a non-zero exit code if argument parsing fails or an exception is raised during execution.
Prerequisites
Before using the CLI, make sure that:
PK-Sim is installed on Windows,
you run the command from a shell that can access the PK-Sim installation directory,
input files and output directories are accessible from that shell.
Note: Any argument value (file name, folder path, etc.) that contains spaces must be enclosed in double quotes, e.g.
"C:\My Projects\input".
Starting the CLI
Open cmd or PowerShell and change to the PK-Sim installation directory. Then use built-in help:
PKSim.CLI --help
PKSim.CLI run --help
PKSim.CLI snap --help
PKSim.CLI export --help
PKSim.CLI qualification --helpBatch run workflow (run)
Use run to process all snapshot JSON files in an input folder, run simulations, and export selected artifacts.
Purpose
This workflow is intended for automated execution of multiple snapshot-based projects. It runs simulations from JSON snapshot files found in the input folder and exports the selected output artifacts to the output folder.
Required options
-i, --inputfolder containing batch snapshot*.jsonfiles-o, --outputfolder for exported files
Optional behavior
--forAllruns simulations with all outputs enabled (default isfalse)
Export format flags
-c, --csvexport simulation results to CSV-x, --xmlexport simulations to SimModel-XML-j, --jsonexport results to JSON (individual simulations only)-k, --pkmlexport simulations to PKML-e, --excelexport results to XLSX (individual simulations only)
General options
--cores <number>maximum number of cores used for parallel work such as model construction and simulation runs. Default is the number of processors minus one. A value smaller than 1 is raised to 1, so at least one core is always used.--logLevel <Debug|Information|Warning|Error>controls verbosity. Default isInformation.-l, --log <full path>writes logs to a file in addition to console output.
Examples
Snapshot workflow (snap)
Use snap to convert batches of PK-Sim projects and snapshots.
Purpose
This workflow converts project representations in bulk between PK-Sim project files and snapshot files so projects can be recreated or migrated with snapshot-based automation.
Required options
-i, --inputinput folder-o, --outputoutput folder
Conversion mode
-s, --snapshotconverts*.pksim5project files to*.jsonsnapshots-p, --projectconverts*.jsonsnapshots to*.pksim5project files
General options
--cores <number>maximum number of cores used for parallel work such as model construction and simulation runs. Default is the number of processors minus one. A value smaller than 1 is raised to 1, so at least one core is always used.--logLevel <Debug|Information|Warning|Error>controls verbosity. Default isInformation.-l, --log <full path>writes logs to a file in addition to console output.
Examples
Project export workflow (export)
Use export to load one PK-Sim project file and export all or selected simulations.
Purpose
This workflow is intended for exporting simulation artifacts from a specific PK-Sim project. It can export all simulations or a selected subset, with optional simulation execution before export.
Required options
-p, --projectfull path to the*.pksim5project file-o, --outputoutput folder for exported artifacts
Optional behavior
-s, --simulationsoptional list of simulation names separated by spaces (e.g.-s S1 S2 "My Simulation"); if omitted, all simulations are exported-r, --runrun simulations before export (default isfalse)
Export format flags
-c, --csvexport simulation results to CSV-x, --xmlexport simulations to SimModel-XML-j, --jsonexport results to JSON (individual simulations only)-k, --pkmlexport simulations to PKML-e, --excelexport results to XLSX (individual simulations only)
General options
--cores <number>maximum number of cores used for parallel work such as model construction and simulation runs. Default is the number of processors minus one. A value smaller than 1 is raised to 1, so at least one core is always used.--logLevel <Debug|Information|Warning|Error>controls verbosity. Default isInformation.-l, --log <full path>writes logs to a file in addition to console output.
Examples
Qualification workflow (qualification)
Use qualification to validate or run a qualification workflow from a qualification plan.
Purpose
This workflow supports qualification automation from a qualification plan, including validation-only runs and full qualification processing with optional simulation execution and project export.
Required option
-i, --inputpath to the JSON qualification plan
Workflow options
-v, --validatevalidation run-r, --runrun simulations during qualification processing-e, --expadditionally export project files (*.jsonsnapshot and*.pksim5project)
General options
--cores <number>maximum number of cores used for parallel work such as model construction and simulation runs. Default is the number of processors minus one. A value smaller than 1 is raised to 1, so at least one core is always used.--logLevel <Debug|Information|Warning|Error>controls verbosity. Default isInformation.-l, --log <full path>writes logs to a file in addition to console output.
Examples
Notes
Snapshot conversion and batch run commands process files in the specified input folder.
If required files are missing (for example, input folders, project files, or configuration files), the command fails with an error.
For population simulations, population CSV export is always generated by the export pipeline.
Last updated