cleanup the path the user enters

This commit is contained in:
2024-08-08 12:41:58 -04:00
parent b8d9b7b9d3
commit b0772bcb1c
+11
View File
@@ -778,6 +778,17 @@ Function Get-FileSizes {
$IncludeHidden = $false
}
# If the path is not an absolute path, make it so
ElseIf ( -not (Test-Path $Path) ) {
$NewPath = $Path[0] + ":\"
If ( -not (Test-Path $NewPath) ) {
Write-Error "Could not find path: ${Path}"
Return
}
$Path = $NewPath
}
}
# Change the sort order depending on which parameter set was specified
Switch ( $PSCmdlet.ParameterSetName ) {
"largest" { $SortOrder = $true ; $Quantity = $Largest }