Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 0c5f2f8

Browse files
Cydrozandyleejordan
authored andcommitted
Add tab step to customise increment varname
1 parent 01cc9fe commit 0c5f2f8

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

‎snippets/PowerShell.json‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -166,16 +166,16 @@
166166
"description": "Insert a foreach loop with Write-Progress initialized",
167167
"body": [
168168
"\\$total = \\$${1:array}.count",
169-
"\\$i = 1",
170-
"\\$progPercent = \"{0:n2}\" -f ([math]::round(\\$i/\\$total,4) * 100)",
171-
"Write-Progress -Activity \"${3:activityName}\" -Status \"\\$i of \\$total - \\$progPercent% Complete:\" -PercentComplete \\$progPercent",
169+
"\\$${4:i} = 1",
170+
"\\$progPercent = \"{0:n2}\" -f ([math]::round(\\$${4:i}/\\$total,4) * 100)",
171+
"Write-Progress -Activity \"${3:activityName}\" -Status \"\\$${4:i} of \\$total - \\$progPercent% Complete:\" -PercentComplete \\$progPercent",
172172
"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",
173+
" \\$progPercent = \"{0:n2}\" -f ([math]::round(\\$${4:i}/\\$total,4) * 100)",
174+
" Write-Progress -Activity \"${3:activityName}\" -Status \"\\$${4:i} of \\$total - \\$progPercent% Complete:\" -PercentComplete \\$progPercent",
175175
" # Insert Code Here",
176176
" ${0}",
177177
" ",
178-
" \\$i++",
178+
" \\$${4:i}++",
179179
"}",
180180
""
181181
]

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /