1. Technology
Glossary|Tips/Tricks|FREE App/VCL|Best'O'Net|Books|Link Back

Delphi Programming RTL Reference|By Category|Alphabetically|By Unit
 

FindCmdLineSwitch

unit
SysUtils
category
command line utilities

declaration
type TSysCharSet = set of Char;

function FindCmdLineSwitch(const Switch: string; SwitchChars: TSysCharSet; IgnoreCase: Boolean): Boolean;

description
Returns True if a specified string was passed as a command line argument.
TSysCharSet is a set containing special characters (e.g., "-" and "/" are common) that can be used to parse a string. The IgnoreCase parameter controls whether a case-sensitive or case-insensitive search is performed.

example
var s : string;
    sc: TSysCharSet;

s:='help';
sc:=['/','-','|'];

// executed as: AppName.exe /help

if FindCmdLineSwitch(s,sc,False) then
   ShowMessage('Application called with
                HELP parameter!');

in real code
Run with Parameters
How to pass command-line parameters to your Delphi application and how to handle them.

see also
ParamCount, CmdLine, ParamStr


 Free Delphi code snippet inside every Delphi Newsletter!
Subscribe to the Newsletter
Name
Email

 Got some code to share? Got a question? Need some help?

©2014 About.com. All rights reserved.