1. Technology

How to Read Windows Command Line Syntax

command-line-syntax-iconIf you are using a Windows PC, you probably have seen or used a command-line to get something done on your Windows PC. If you ever need help with some command, there are plenty of sites to help you with the syntax and usage of the commands. But, unless you know how to read that command line syntax, that help is nothing but a gibberish string.

For instance, if you check the official command line reference for the command attrib, you will see the command line syntax something like this.

ATTRIB [{+R|-R}] [{+A|-A}] [{+S|-S}] [{+H|-H}] [[drive:][path] filename] [/S[/D]]

As you can see, the above command line syntax contains all sorts of variations like upper and lower case, and special characters like spaces, brackets (“[ ]“), braces (“({})”), and pipes (” | “). The above command line doesn’t make any sense to an untrained eye, but it informs you of the different parameters that you can use with the attrib command.

command-line-syntax-attrib-cmd

How to Read Command Syntax

A command syntax is nothing but the rules which govern how a command can be used or run. Unless you know how to read the command line syntax, you can’t use or understand the commands properly or to their full potential. So in this basic tutorial, let us hop on and learn some basics on how to read command line syntax. As per the example, you can take the above “attrib” command and use the information below to interpret that command.

Special Character “+”: Whenever you use the special character + in front of an item or parameter, it means that you are setting up that parameter for the task you are doing.

For instance, in the above attrib command, whenever you use the parameter +R in the command, you are setting the read-only mode for a selected file or folder.

Special Character “-“: Whenever you use the special character - in front of an item or parameter, it means that you are clearing up that parameter for the task you are doing.

For instance, in the above attrib command, whenever you use the parameter -R in the command, you are removing the read-only mode for a selected file or folder.

Characters in Caps: In command line syntax, characters represented in capitals are what users should type exactly. When I say characters, it includes all the numbers, special characters and letters.

For example, in the above attrib command, the base command ATTRIB and the switches like -R, +A, /S, etc., should be used as is without any modifications whatsoever. So the valid command looks something like this,

ATTRIB +R

but not like this, which eliminates the special character “+”.

ATTRIB R

Characters in Smalls: Whenever you see small character representation, it just means that the user should supply the information required for the command to execute properly.

For example, in the above attrib command, you need to supply the information like the drive and the file path in the place of [[drive:][path] filename]. Once supplied, the command looks something like this.

ATTRIB C:folderfile.txt

Pipes (Vertical Bars): Pipes or vertical bars are used to show the various parameters that you can use inside the brackets or braces. It has the same meaning as “either…or,” which means only one of the parameters can be used. Pipes or vertical bars is for illustration only and should not be used with actual commands.

For example, in the above attrib command, you can see that the switches +R and -R are separated by a vertical bar, which means that they are two different parameters and only one of them (either +R or -R) can be used in the actual command.

Braces (“{ }”): Any items or parameters inside braces are a set of choices where a user should choose one, i.e. you can choose one parameter between a group of parameters inside the braces. Also, you shouldn’t use braces with actual commands.

For example, the command syntax {+A | -A} suggests that you can either use the switch +A or -A in the actual command but not both of them at the same time, as they belong to the same group. So the valid command looks something like this,

ATTRIB +A

but not like this, which uses both options at the same time.

ATTRIB +A -A

Brackets (“[ ]“): Any items or parameters inside brackets are optional, i.e. it is up to you to use those parameters or not. Also, you shouldn’t use brackets with actual commands.

For example, in the above attrib command, the syntax [{+R|-R}] suggests that you can either use the optional parameters or not (also, keep the braces in mind). So, any of the below commands are valid.

ATTRIB +R

or

ATTRIB

Spaces: Even spaces have meaning in command syntax. If you find a space in the command syntax, then you should use it while executing the actual command.

For example, in the above attrib command, you shouldn’t eliminate any of the spaces. So, a valid command will look something like this,

ATTRIB +R -H

but not like this, which eliminates the spaces.

ATTRIB+R-H

Text Outside Brackets: Just like Spaces, any text outside of the brackets must be used and should be used “as is” while executing the commands.

For example, in the above attrib command, the base command ATTRIB must be used and should be used as is. So the valid command looks something like this,

ATTRIB +R -H C:folderfile.txt

and not like this, which eliminates the usage of the text outside brackets.

+R -H C:folderfile.txt

Ellipsis (“…”): Ellipsis is not so common in any syntax, but if you see an ellipsis, then it means that the item or parameter can be repeated endlessly.

Conclusion

Knowing how to interpret command line syntax is very helpful for understanding and using the command references found in the official documentation and on the Internet. Sure, it may take some time to get hold of these syntax rules, but it is worth it.

Don’t forget to share your thoughts using the comment form below.

The post How to Read Windows Command Line Syntax appeared first on Make Tech Easier.



No Comments
Comments to: How to Read Windows Command Line Syntax

Recent Articles

Good Reads

Gemstones have been a source of fascination for centuries due to their unique colors, properties, and potential to influence emotions and energy. In addition to their aesthetic value, gemstones have been highly regarded by many cultures for their alleged ability to attract positive energy and prosperity. This article​ will discuss the ⁤arrangement of different gemstones […]

Worlwide

Overview VipsPM – Project Management Suite is a Powerful web-based Application. VipsPM is a perfect tool to fulfill all your project management needs like managing Projects, Tasks, Defects, Incidents, Timesheets, Meetings, Appointments, Files, Documents, Users, Clients, Departments, ToDos, Project Planning, Holidays and Reports. It has simple yet efficient layout will make managing projects easier than […]
Gemstones have been a source of fascination for centuries due to their unique colors, properties, and potential to influence emotions and energy. In addition to their aesthetic value, gemstones have been highly regarded by many cultures for their alleged ability to attract positive energy and prosperity. This article​ will discuss the ⁤arrangement of different gemstones […]
Bathroom lighting may not be a top priority for many homeowners in Singapore, but it can greatly impact our‌ experience in the ⁤space. To achieve optimal ⁤bathroom lighting, there are several factors to consider and tips to keep in mind when⁢ discussing lighting ‌concepts with your interior design‍ firm in Singapore. Why is Bathroom Lighting […]

Trending

Turquoise Jewelry is one of the ancient healing stones used for personal adornment and astrological benefits. The rare greenish blue-colored pectolite is celebrated for its enchanting powers among many crystal lovers. It is a hydrated phosphate of copper and aluminum that ranks 5 to 6 on the Mohs hardness scale. It is deemed a protective […]
2020 has been a year that represents aggressive and sustained volatility with a confluence of unexpected situations, including economic shifts and market disturbance confluence. The COVID-19 pandemic forces businesses to adjust their methods of operations to ensure survival. These adjustments become the trajectory and guidance of what 2021 should look like and what companies should […]
COVID-19 pandemic has affected Thailand’s economy and labor market. World Bank’s Thailand Economic Monitor predicted that it would take Thailand over two years to return to its pre-COVID-19 growth and domestic product output levels. Although the country has successfully curbed the pandemic tide over the last few months, the economy remains severely hit. Nevertheless, heavily […]