CommandLineParserGetExecutableName Method

Gets the name of the executable used to invoke the application.

Definition

Namespace: Ookii.CommandLine
Assembly: Ookii.CommandLine (in Ookii.CommandLine.dll) Version: 4.0.0+bb7ed9a8fdfd1cb21824750a8cf508863ad15086
C#
public static string GetExecutableName(
	bool includeExtension = false
)

Parameters

includeExtension  Boolean  (Optional)
to include the file name extension in the result; otherwise, .

Return Value

String
The file name of the application's executable, with or without extension.

Remarks

To determine the executable name, this method first checks the EnvironmentProcessPath property (if using .Net 6.0 or later). If using the .Net Standard package, or if EnvironmentProcessPath returns "dotnet", it checks the first item in the array returned by EnvironmentGetCommandLineArgs, and finally falls back to the file name of the entry point assembly.

The return value of this function is used as the default executable name to show in the usage syntax when generating usage help, unless overridden by the UsageWriterExecutableName property.

See Also