description | ms.date | ms.topic | title |
---|---|---|---|
Use exact casing of cmdlet/function/parameter name. |
03/19/2025 |
reference |
UseCorrectCasing |
Severity Level: Information
This is a style/formatting rule. PowerShell is case insensitive wherever possible, so the casing of cmdlet names, parameters, keywords and operators does not matter. This rule nonetheless ensures consistent casing for clarity and readability. Using lowercase keywords helps distinguish them from commands. Using lowercase operators helps distinguish them from parameters.
- Use exact casing for type names.
- Use exact casing of the cmdlet and its parameters.
- Use lowercase for language keywords and operators.
Rules = @{
PS UseCorrectCasing = @{
Enable = $true
CheckCommands = $true
CheckKeyword = $true
CheckOperator = $true
}
}
Enable or disable the rule during ScriptAnalyzer invocation.
If true, require the case of all operators to be lowercase.
If true, require the case of all keywords to be lowercase.
If true, require the case of all commands to match their actual casing.
ForEach ($file in Get-childitem -Recurse) {
$file.Extension -eq '.txt'
}
invoke-command { 'foo' } -runasadministrator
foreach ($file in Get-ChildItem -Recurse) {
$file.Extension -eq '.txt'
}
Invoke-Command { 'foo' } -RunAsAdministrator