|
162 | 162 | ]
|
163 | 163 | },
|
164 | 164 | "Foreach with Progress": {
|
165 |
| - "prefix": "foreach-progress", |
| 165 | + "prefix": "foreach-progress", |
166 | 166 | "description": "Insert a foreach loop with Write-Progress initialized",
|
167 |
| - "body": [ |
168 |
| -\\$progPercent = \"{0:n2}\" -f ([math]::round(\\$i/\\$array.count,4) * 100)", |
169 |
| - |
170 |
| -Write-Progress -Activity \"${3:activityName}\" -Status \"\\$i of \\$array.count - \\$progPercent% Complete:\" -PercentComplete \\$progPercent", |
171 |
| - "\\$i = 1", |
172 |
| - "foreach ($${2:item} in $${1:array}) {", |
173 |
| - " \\$progPercent = \"{0:n2}\" -f ([math]::round(\\$i/\\$total,4) * 100)", |
174 |
| - " Write-Progress -Activity \"${3:activityName}\" -Status \"\\$i of \\$total - \\$progPercent% Complete:\" -PercentComplete \\$progPercent", |
175 |
| - " # Insert Code Here", |
176 |
| - " ${0}", |
177 |
| - " ", |
178 |
| - " \\$i++", |
179 |
| - "}", |
180 |
| - "" |
181 |
| - ] |
182 |
| - }, |
| 167 | + "body": [ |
| 168 | + "\\$progPercent = \"{0:n2}\" -f ([math]::round(\\$i/\\$array.count,4) * 100)", |
| 169 | + "Write-Progress -Activity \"${3:activityName}\" -Status \"\\$i of \\$array.count - \\$progPercent% Complete:\" -PercentComplete \\$progPercent", |
| 170 | + "\\$i = 1", |
| 171 | + "foreach ($${2:item} in $${1:array}) {", |
| 172 | + " \\$progPercent = \"{0:n2}\" -f ([math]::round(\\$i/\\$total,4) * 100)", |
| 173 | + " Write-Progress -Activity \"${3:activityName}\" -Status \"\\$i of \\$total - \\$progPercent% Complete:\" -PercentComplete \\$progPercent", |
| 174 | + " # Insert Code Here", |
| 175 | + " ${0}", |
| 176 | + " ", |
| 177 | + " \\$i++", |
| 178 | + "}", |
| 179 | + "" |
| 180 | + ] |
| 181 | + }, |
183 | 182 | "ForEach-Object -Parallel": {
|
184 | 183 | "prefix": "foreach-parallel",
|
185 | 184 | "description": "[PS 7+] Process multiple objects in parallel using runspaces. This has some limitations compared to a regular ForEach-Object. More: Get-Help ForEach-Object",
|
|
0 commit comments