@@ -61,12 +61,12 @@ function GetCommandAlias {
61
61
$isGlobal = $false
62
62
63
63
# Evaluate if the command uses named parameter Scope set to Global. Always start at second element.
64
- 1 .. ( $ aliasCommandAst.CommandElements.Count - 1 ) | ForEach-Object - Process {
65
- if ($aliasCommandAst.CommandElements [$_ ] -is [System.Management.Automation.Language.CommandParameterAst ] `
66
- -and $aliasCommandAst.CommandElements [$_ ].ParameterName -eq ' Scope'
64
+ for ( $i = 1 ; $i -lt $ aliasCommandAst.CommandElements.Count - 1 ; $i ++ ) {
65
+ if ($aliasCommandAst.CommandElements [$i ] -is [System.Management.Automation.Language.CommandParameterAst ] `
66
+ -and $aliasCommandAst.CommandElements [$i ].ParameterName -eq ' Scope'
67
67
) {
68
68
# Value (the scope) is in the next item in the array.
69
- if ($aliasCommandAst.CommandElements [$_ + 1 ].Value -imatch ' Global' ) {
69
+ if ($aliasCommandAst.CommandElements [$i + 1 ].Value -ieq ' Global' ) {
70
70
$isGlobal = $true
71
71
}
72
72
}
@@ -81,12 +81,12 @@ function GetCommandAlias {
81
81
$aliasName = $aliasCommandAst.CommandElements [1 ].Value
82
82
} else {
83
83
# Evaluate if the command uses named parameter Name. Always start at second element.
84
- 1 .. ( $ aliasCommandAst.CommandElements.Count - 1 ) | ForEach-Object - Process {
85
- if ($aliasCommandAst.CommandElements [$_ ] -is [System.Management.Automation.Language.CommandParameterAst ] `
86
- -and $aliasCommandAst.CommandElements [$_ ].ParameterName -eq ' Name'
84
+ for ( $i = 1 ; $i -lt $ aliasCommandAst.CommandElements.Count - 1 ; $i ++ ) {
85
+ if ($aliasCommandAst.CommandElements [$i ] -is [System.Management.Automation.Language.CommandParameterAst ] `
86
+ -and $aliasCommandAst.CommandElements [$i ].ParameterName -eq ' Name'
87
87
) {
88
88
# Value (the alias name) is in the next item in the array.
89
- $aliasName = $aliasCommandAst.CommandElements [$_ + 1 ].Value
89
+ $aliasName = $aliasCommandAst.CommandElements [$i + 1 ].Value
90
90
}
91
91
}
92
92
}
0 commit comments