PowerShell provides operators for working with bytes. These operators are as follows:
- nKB: Kilobytes (n * 10241)
- nMB: Megabytes (n * 10242)
- nGB: Gigabytes (n * 10243)
- nTB: Terabytes (n * 10244)
- nPB: Petabytes (n * 10245)
These operators can be used to represent large values:
PS> 22.5GB
24159191040
The operators may also be used to convert large byte values to shorter values. For example, a shorter value might be added to a message using the format operator:
PS> '{0:F} TB available' -f (123156235234522 / 1TB)
112.01 TB available