Search notes:

PowerShell parameter attribute: alias

Question mark as parameter name

The Parameter attribute alias comes in handy to define a question mark parameters:
param (
   [alias('?')] [switch] $help
)

if ($help) {
  'help message'
   return
}

'doing stuff'
Github repository about-PowerShell, path: /language/statement/function/parameters/attributes/alias/qm.ps1
PS:> .\qm
doing stuff

PS:> .\qm -?
help message
Unfortunately, this technique does not seem to work when trying to alias an exclamation mark to a parameter.

Index