The optional parts of the command after the actual command name. Often proceeded by the "-" character in UNIX, and the "/" in Microsoft operating systems. For example: ls -lsa

Command line options are the parameters passed to a program when it is invoked from a command line environment. In this environment, you type the name of the program you wish to run (rather than, for example, clicking its icon with a mouse) and then press the "Enter" key. If you need to provide more information to the program, you would use command line options.

Although the format of these options are not formally standardized, certain conventions are typically followed. The most common ways of listing command line options are to delimit the various options with spaces or to preface each option with a "-" or "/". It is entirely up to the developer how to handle command line options and the user documentation must be read to know what command line options are available and what their purposes are.

Let's say that you wish to run a program that adds 2 numbers together. The name of this program is AddIt. The documentation appears below.

 


Welcome to AddIt! The program that adds two numbers together and tells you the result!

  1. If you want AddIt to prompt you for the two numbers then type the following at the command line:

    C:>addit

  2. If you want to provide one of the numbers and have AddIt prompt you for the second number then type the following at the command line (assume "5" is your first number):

    C:>addit 5

  3. If you want to provide both of the numbers and have AddIt display the result then type the following at the command line (assume "5" is your first number and "3" is your second number):

    C:>addit 5 3


In the examples above, #1 used no command line options, #2 used one command line option and #3 used two command line options.

Log in or registerto write something here or to contact authors.