0

In this command what is "-gt 1" and "-f".

Get-PSDrive | ?{$_.Free -gt 1} | %{$Count = 0; Write-Host "";}{$_.Name + ": Used: " + "{0:N2}" -f ($_.Used/1gb) + “Free: " + "{0:N2}" -f ($_.Free/1gb) + " Total: " + "{0:N2}" -f (($_.Used/1gb)+($_.Free/1gb)); $Count = $Count + $_.Free;} {Write-Host ""; Write-Host "Total Free Space " ("{0:N2}" -f ($Count/1gb)) -BackgroundColor magenta}
Jeff Zeitlin
  • 9,773
  • 2
  • 21
  • 33
  • 2
    I commend to your attention the output of [`Get-Help about_Operators`](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_operators?view=powershell-7). – Jeff Zeitlin Mar 26 '20 at 19:49
  • Search terms with characters such as `-` are hard to google. See [this answer](https://stackoverflow.com/a/59324892/45375) for a PowerShell function that enables direct lookup of help for PowerShell operators. – mklement0 Mar 26 '20 at 22:22

1 Answers1

1

-gt 1 is a Comparison Operator meaning "Greater Than" 1

-f is a Format Operator so that you can format the output string.

HAL9256
  • 12,384
  • 1
  • 34
  • 46