Appendix B: Cmdlet Naming


The cmdlets installed with Windows PowerShell all follow a standard naming convention. In general, they use a verb–noun pair. For example, there are four commands that start with the verb add. “Add what?” you may ask. This is where the noun comes into play: Add-Content, Add-History, Add-Member, and Add-PSSnapin. When creating cmdlets, you should endeavor to follow the same kind of naming convention. The recognition of this naming convention is helpful in learning the cmdlets that come with Windows PowerShell.

Table B-1: Cmdlet Naming
Open table as spreadsheet

Count

Verb

Examples

4

Add

Add-Content, Add-History, Add-Member

4

Clear

Clear-Content, Clear-Item

1

Compare

Compare-Object

1

ConvertFrom

ConvertFrom-SecureString

1

Convert

Convert-Path

2

ConvertTo

ConvertTo-Html, ConvertTo-SecureString

2

Copy

Copy-Item, Copy-ItemProperty

4

Export

Export-Alias, Export-Clixml, Export-Console

1

ForEach

ForEach-Object

4

Format

Format-Custom, Format-List, Format-Table

29

Get

Get-Acl, Get-Alias

1

Group

Group-Object

3

Import

Import-Clixml, Import-Csv

3

Invoke

Invoke-Expression, Invoke-History

1

Join

Join-Path

2

Measure

Measure-Command, Measure-Object

2

Move

Move-Item, Move-ItemProperty

8

New

New-Alias, New-Item, New-ItemProperty

6

Out

Out-Default, Out-File, Out-Host

1

Pop

Pop-Location

1

Push

Push-Location

1

Read

Read-Host

5

Remove

Remove-Item, Remove-ItemProperty

2

Rename

Rename-Item, Rename-ItemProperty

1

Resolve

Resolve-Path

1

Restart

Restart-Service

1

Resume

Resume-Service

2

Select

Select-Object, Select-String

13

Set

Set-Acl, Set-Alias

1

Sort

Sort-Object

1

Split

Split-Path

3

Start

Start-Service, Start-Sleep, Start-Transcript

3

Stop

Stop-Process, Stop-Service, Stop-Transcript

1

Suspend

Suspend-Service

1

Tee

Tee-Object

1

Test

Test-Path

1

Trace

Trace-Command

2

Update

Update-FormatData, Update-TypeData

1

Where

Where-Object

7

Write

Write-Debug, Write-Error, Write-Host




Microsoft Press - Microsoft Windows PowerShell Step by Step
MicrosoftВ® Windows PowerShell(TM) Step By Step (Step By Step (Microsoft))
ISBN: 0735623953
EAN: 2147483647
Year: 2007
Pages: 128
Authors: Ed Wilson

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net