Command Line Option

Definition - 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.

Share this:

Techopedia Deals

Connect with us

Techopedia on Linkedin
Techopedia on Linkedin
"Techopedia" on Twitter

Sign up for Techopedia's Free Newsletter!

Email Newsletter

Join thousands of others with our weekly newsletter

The 4th Era of IT Infrastructure: Superconverged Systems
The 4th Era of IT Infrastructure: Superconverged Systems:
Learn the benefits and limitations of the 3 generations of IT infrastructure – siloed, converged and hyperconverged – and discover how the 4th...
Approaches and Benefits of Network Virtualization
Approaches and Benefits of Network Virtualization:
Businesses today aspire to achieve a software-defined datacenter (SDDC) to enhance business agility and reduce operational complexity. However, the...
Free E-Book: Public Cloud Guide
Free E-Book: Public Cloud Guide:
This white paper is for leaders of Operations, Engineering, or Infrastructure teams who are creating or executing an IT roadmap.
Free Tool: Virtual Health Monitor
Free Tool: Virtual Health Monitor:
Virtual Health Monitor is a free virtualization monitoring and reporting tool for VMware, Hyper-V, RHEV, and XenServer environments.
Free 30 Day Trial – Turbonomic
Free 30 Day Trial – Turbonomic:
Turbonomic delivers an autonomic platform where virtual and cloud environments self-manage in real-time to assure application performance.