← Docs home

Support Wildcard Characters

📐 Guideline.

A cmdlet should support wildcard characters where possible, especially when a parameter takes a string to identify one object from a set of objects. For example, the sample Stop-Proc cmdlet defines a Name parameter for process names that supports wildcards so the user can easily specify the processes to stop.

Arrays and single-item resolution.

When wildcard support is available, a cmdlet operation usually produces an array. Occasionally an array does not make sense because the user uses only a single item at a time. For example, Set-Location does not need an array because the user sets only a single location. It still supports wildcards, but it forces resolution to a single location.