November 2018
Intermediate to advanced
566 pages
17h 15m
English
When I was learning PowerShell, I came across a recipe, Work with Numbers as Binary, in the book Windows PowerShell Cookbook by Lee Holmes, where he showed how file attribute flags worked in PowerShell. To see what attributes are available in PowerShell for files and directories, and see their decimal and binary representations, enter the following at the PowerShell prompt:
PS> [Enum]::GetValues([System.IO.FileAttributes]) | Select-Object `@{ n = 'Property'; e = { $_ } }, `@{ n = 'Integer'; e = { [int]$_ } }, `@{ n = 'Hexadecimal'; e = { [Convert]::ToString([int]$_, 16) } }, `@{ n = 'Binary'; e = { [Convert]::ToString([int]$_, 2) } }
This is what the command gives you:
That brings us to the end of this chapter. Basic arithmetic ...
Read now
Unlock full access