UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FCommandLine Struct Reference

#include <CommandLine.h>

Static Public Member Functions

static CORE_API void Reset ()
 
static CORE_API const TCHARGet ()
 
static CORE_API const TCHARGetForLogging ()
 
static CORE_API const TCHARGetOriginal ()
 
static CORE_API const TCHARGetOriginalForLogging ()
 
static CORE_API bool IsInitialized ()
 
static CORE_API uint32 GetCommandLineVersion ()
 
static CORE_API bool Set (const TCHAR *NewCommandLine)
 
static CORE_API void Append (const TCHAR *AppendString)
 
static CORE_API void RegisterArgument (FStringView Name, ECommandLineArgumentFlags Flags, FStringView Description=FStringView())
 
static CORE_API void AddToSubprocessCommandline (const TCHAR *Param)
 
static CORE_API void AddToSubprocessCommandLine (const TCHAR *Param, ECommandLineArgumentFlags ApplicationContextFlags)
 
static CORE_API const FString & GetSubprocessCommandline ()
 
static CORE_API void BuildSubprocessCommandLine (ECommandLineArgumentFlags ApplicationContextFlags, bool bOnlyInherited, FStringBuilderBase &OutCommandline)
 
static CORE_API const TCHARRemoveExeName (const TCHAR *CmdLine)
 
static CORE_API void Parse (const TCHAR *CmdLine, TArray< FString > &Tokens, TArray< FString > &Switches)
 
static CORE_API bool IsCommandLineLoggingFiltered ()
 
static CORE_API FString BuildFromArgV (const WIDECHAR *Prefix, int32 ArgC, WIDECHAR *ArgV[], const WIDECHAR *Suffix)
 
static CORE_API FString BuildFromArgV (const ANSICHAR *Prefix, int32 ArgC, ANSICHAR *ArgV[], const ANSICHAR *Suffix)
 
static bool FilterCLIUsingGrammarBasedParser (TCHAR *OutLine, int32 MaxLen, const TCHAR *InLine, const TArrayView< FString > &AllowedList)
 

Static Public Attributes

static constexpr uint32 MaxCommandLineSize = 16384
 

Member Function Documentation

◆ AddToSubprocessCommandline()

void FCommandLine::AddToSubprocessCommandline ( const TCHAR Param)
static

Adds a new parameter to subprocess command line. If Param does not start with a space, one is added.

Parameters
ParamCommand line param string.

◆ AddToSubprocessCommandLine()

void FCommandLine::AddToSubprocessCommandLine ( const TCHAR Param,
ECommandLineArgumentFlags  ApplicationContextFlags 
)
static

Adds a new parameter to subprocess command line. If Param does not start with a space, one is added.

Parameters
ParamCommand line param string.
ApplicationContextFlagsThe one or more application context flags to which this parameter applies.

◆ Append()

void FCommandLine::Append ( const TCHAR AppendString)
static

Appends the passed string to the command line as it is (no space is added).

Parameters
AppendStringString that should be appended to the commandline.

◆ BuildFromArgV() [1/2]

FString FCommandLine::BuildFromArgV ( const ANSICHAR Prefix,
int32  ArgC,
ANSICHAR ArgV[],
const ANSICHAR Suffix 
)
static

◆ BuildFromArgV() [2/2]

FString FCommandLine::BuildFromArgV ( const WIDECHAR Prefix,
int32  ArgC,
WIDECHAR ArgV[],
const WIDECHAR Suffix 
)
static

Builds a command line string from the ArgC/ArgV main() arguments, together with an optional prefix or suffix, for adding additional command list arguments programmatically.

◆ BuildSubprocessCommandLine()

void FCommandLine::BuildSubprocessCommandLine ( ECommandLineArgumentFlags  ApplicationContextFlags,
bool  bOnlyInherited,
FStringBuilderBase OutCommandline 
)
static

Builds a commandline of inheritable and subprocess arguments for a specified application context.

Parameters
FlagsThe flags indicating the subprocess context we want a commandline for.
bOnlyInheritedIf true, only add inherited arguments, not explicitly supplied subprocess arguments.
OutCommandline[out] The composed commandline.

◆ FilterCLIUsingGrammarBasedParser()

bool FCommandLine::FilterCLIUsingGrammarBasedParser ( TCHAR OutLine,
int32  MaxLen,
const TCHAR InLine,
const TArrayView< FString > &  AllowedList 
)
static

FilterCLIUsingGrammarBasedParser parses CLI style arguments. filters for commands or keys specified in the AllowedList and writes the to the OutLine. OutLine and InLine may be point to the same buffer.

Parameters
OutLine[out] the destination of the filtered InLine
MaxLenthe maximum length the OutLIne can hold.
InLinethe CLI to be filtered.
AllowedListthe list of commands or key permitted to pass the filter.

Returns true if Outline was large enough to hold the filtered string, Otherwise returns false.

◆ Get()

const TCHAR * FCommandLine::Get ( )
static

Returns an edited version of the executable's command line with the game name and certain other parameters removed.

◆ GetCommandLineVersion()

uint32 FCommandLine::GetCommandLineVersion ( )
static

Gets a number representing this version of the command line, incremented each command line change

◆ GetForLogging()

const TCHAR * FCommandLine::GetForLogging ( )
static

Returns an edited version of the executable's command line.

◆ GetOriginal()

const TCHAR * FCommandLine::GetOriginal ( )
static

Returns the command line originally passed to the executable.

◆ GetOriginalForLogging()

const TCHAR * FCommandLine::GetOriginalForLogging ( )
static

Returns an edited version of the command line originally passed to the executable.

◆ GetSubprocessCommandline()

const FString & FCommandLine::GetSubprocessCommandline ( )
static

Returns the subprocess command line string (without inherited or context specific arguments)

◆ IsCommandLineLoggingFiltered()

bool FCommandLine::IsCommandLineLoggingFiltered ( )
static

Checks if command line logging filtering is enabled

Returns true if logging filter is enabled

◆ IsInitialized()

bool FCommandLine::IsInitialized ( )
static

Checks if the command line has been initialized.

◆ Parse()

void FCommandLine::Parse ( const TCHAR InCmdLine,
TArray< FString > &  Tokens,
TArray< FString > &  Switches 
)
static

Parses a string into tokens, separating switches (beginning with -) from other parameters

Parameters
CmdLinethe string to parse
Tokens[out] filled with all parameters found in the string
Switches[out] filled with all switches found in the string

◆ RegisterArgument()

void FCommandLine::RegisterArgument ( FStringView  Name,
ECommandLineArgumentFlags  Flags,
FStringView  Description = FStringView() 
)
static

Registers a command line argument and associates it with a set of flags and optionally a description.

Parameters
NameArgument name on the commandline that should be inherited.
FlagsFlags to be associated with the argument.

◆ RemoveExeName()

const TCHAR * FCommandLine::RemoveExeName ( const TCHAR InCmdLine)
static

Removes the executable name from the passed CmdLine, denoted by parentheses. Returns the CmdLine string without the executable name.

Removes the executable name from a commandline, denoted by parentheses.

◆ Reset()

void FCommandLine::Reset ( )
static

Resets FCommandLine to an uninitialised state as if Set() has never been called

◆ Set()

bool FCommandLine::Set ( const TCHAR NewCommandLine)
static

Sets CmdLine to the string given

Member Data Documentation

◆ MaxCommandLineSize

constexpr uint32 FCommandLine::MaxCommandLineSize = 16384
inlinestaticconstexpr

maximum size of the command line


The documentation for this struct was generated from the following files: