What Does Command Line Option Mean?
Command-line options are commands used to pass parameters to a program. These entries, also called command-line switches, can pass along cues for changing various settings or executing commands in an interface.
Techopedia Explains Command Line Option
The syntax of command-line options differs from one operating system to another. In MS-DOS/Windows, by convention, a command-line option is indicated by a letter prefixed with a forward slash.
As an example, the XCOPY command, which is used for copying files and directories, can be started using the the following options, among others:
- /T — copy the directory structure only
- /C — continue even if an error occurs
- /R — overwrite read-only files
Thus the command “xcopy c:dir1 d:dir2 /R” will copy files and subdirectories from the subdirectory “dir1” in drive “C:” to the subdirectory “dir2” in drive “D:”, overwriting read-only files already present in “d:dir2”.
In Unix, the convention is to use a hyphen instead of a forward slash, followed by a letter. For example, the command “ls -l” will perform a long listing (“-l”) of the files and subdirectories in the current directory. The list will include other information such as the file sizes, attributes, modification dates, etc. Without the “-l” option, only the names of the files and subdirectories will be listed.
The choice of using a forward slash or a hyphen is programmer dependent. For example, most Linux programs that have been ported to Windows still use the Unix convention when indicating command-line options. The source code must be modified to use the Windows convention.