Get-DownloadPercent.ps1
19 Sep 2025Description
Purpose
Calculates the download percentage based on a decimal value.
Detailed Description
The Get-DownloadPercent function takes a decimal value and calculates the corresponding download percentage. It multiplies the decimal value by 100 and rounds it to the nearest whole number.
Usage
Example 1
Get-DownloadPercent 0.75
Returns: “75%”
Notes
No additional notes.
Script
<#
.SYNOPSIS
Calculates the download percentage based on a decimal value.
.DESCRIPTION
The Get-DownloadPercent function takes a decimal value and calculates the corresponding download percentage. It multiplies the decimal value by 100 and rounds it to the nearest whole number.
.PARAMETER d
The decimal value representing the progress of the download.
.EXAMPLE
Get-DownloadPercent 0.75
Returns: "75%"
#>
function Get-DownloadPercent([decimal]$d) {
$p = [math]::Round($d * 100)
return "$p%"
}
Download
Please feel free to copy parts of the script or if you would like to download the entire script, simply click the download button. You can download the complete repository in a zip file by clicking the Download link in the menu bar on the left hand side of the page.
Report Issues
You can report an issue or contribute to this site on GitHub. Simply click the button below and add any relevant notes. I will attempt to respond to all issues as soon as possible.