RealDocs

UKismetSystemLibrary::ParseCommandLine

function Engine Blueprint Since unknown
#include "Kismet/KismetSystemLibrary.h"
Access: public Specifiers: staticBlueprintCallable

Description

Parses a command line string into loose tokens, boolean switches (arguments beginning with - or /), and key=value parameters.

Caveats & Gotchas

  • Switches that also carry a value (e.g. -bar=/game/baz) are added to OutParams, not OutSwitches — a switch only lands in OutSwitches if it has no '=' value.
  • This parses an arbitrary string you supply; pair it with GetCommandLine() to parse the actual process launch arguments.

Signature

static void ParseCommandLine(const FString& InCmdLine, TArray<FString>& OutTokens, TArray<FString>& OutSwitches, TMap<FString, FString>& OutParams)

Parameters

Name Type Description Default
InCmdLine FString The command line string to parse (e.g. '-foo -bar=/game/baz testtoken').
OutTokens TArray<FString> Filled with all loose tokens found in the string (e.g. 'testtoken').
OutSwitches TArray<FString> Filled with all switches found in the string (e.g. 'foo').
OutParams TMap<FString, FString> Filled with all key=value switches found in the string (e.g. 'bar' -> '/game/baz').

Return Type

void

Example

Split the process command line into tokens, switches, and params C++
TArray<FString> Tokens, Switches;
TMap<FString, FString> Params;
UKismetSystemLibrary::ParseCommandLine(UKismetSystemLibrary::GetCommandLine(), Tokens, Switches, Params);

Version History

Introduced in: unknown

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.