How many bytes?
I was playing around with PowerShell and started thinking about the kb, mb etc values and I realised I didn’t know what they really looked like. 1kb is 1024 but it gets very hazy after that. So how could I see the values stacked up
1kb,1mb,1gb,1tb,1pb | foreach{"$_".PadLeft(16)}
works. We feed in the list of values. Pipe into foreach and use string substitution to display. That will left justify the display. By padding the left of the display with spaces we can effectively right justify the field to give
1024
1048576
1073741824
1099511627776
1125899906842624
So now you know what the stack of xbytes looks like
We can also achieve the same effect using
1kb,1mb,1gb,1tb,1pb | foreach{"{0,16}" -f $_}
Hmm.. wonder how effort is involved to produce a Tower of Hanoi script from this
Read the complete post at http://richardsiddaway.spaces.live.com/Blog/cns!43CFA46A74CF3E96!2265.entry