- Getting Started with PowerShell
- Michael Shepard
- 314字
- 2021-07-16 20:28:21
Interpreting the cmdlet syntax
The syntax section of the cmdlet help can be overwhelming at first, so let's drill into it a bit and try to understand it in detail. I will use the get-service
cmdlet for an example, but the principles are same for any cmdlet:

The first thing to notice is that there are three different get-service
calls illustrated here. They correspond to the PowerShell concept of ParameterSets, but you can think of them as different use cases for the cmdlet. Each ParameterSet, or use case will have at least one unique parameter. In this case, the first includes the –Name
parameter, the second includes –DisplayName
, and the third has the –InputObject
parameter.
Each ParameterSet lists the parameters that can be used in a particular scenario. The way the parameter is shown in the listing, tells you how the parameter can be used. For instance, [[-Name] <String[]>]
means that the name parameter has the following attributes:
- It is optional (because the whole definition is in brackets)
- The parameter name can be omitted (because the name is in brackets)
- The parameter values can be an array (list) of strings (String[])
In general, a parameter will be shown in one of the following forms:

Applying this to the Get-Service
syntax shown previously, we see that some valid calls of the cmdlet could be:
- Building a RESTful Web Service with Spring
- INSTANT Sencha Touch
- 用Flutter極速構建原生應用
- SAP BusinessObjects Dashboards 4.1 Cookbook
- Angular開發入門與實戰
- Learning Material Design
- 移動增值應用開發技術導論
- 寫給程序員的Python教程
- Java并發編程:核心方法與框架
- Python Machine Learning Blueprints:Intuitive data projects you can relate to
- PowerDesigner 16 從入門到精通
- scikit-learn Cookbook(Second Edition)
- JavaScript Mobile Application Development
- 情境微課開發(第2版)
- Clojure High Performance Programming