Mindestens seit XE bietet Sysutils eine überladene Funktion an, die genau das bereits erledigt:
Delphi-Quellcode:
{ This version is used to return values.
Switch values may be specified in the following ways on the command line:
-p Value - clstValueNextParam
-pValue or -p:Value - clstValueAppended
Pass the SwitchTypes parameter to exclude either of these switch types.
Switch may be 1 or more characters in length. }
function FindCmdLineSwitch(const Switch: string; var Value: string; IgnoreCase: Boolean = True;
const SwitchTypes: TCmdLineSwitchTypes = [clstValueNextParam, clstValueAppended]): Boolean; overload;