MonthofLunces v3 Question

This topic contains 0 replies, has 1 voice, and was last updated by  Forums Archives 5 years, 11 months ago.

  • Author
    Posts
  • #5770

    by levi.rogers at 2013-04-04 19:59:48

    Pages 127 and 128. When I am running the following example it doesn't appear that it works correctly:

    Get-Process | Format-Table Name,@{n='VM(MB)'};e={$_.VM};formatstring='F2';align='right'} -autosize

    This is supposed to give similar results as the example on the previous page, it doesn't appear to come out right it just adds 2 decimal places to the end it doesn't appear to actually divide out into mb's.

    Also I was wondering where the 'F2' in that expression comes from I tried to look for it on those MSDN pages but couldn't find it in there unless that is somehow concatenated.

    Your help would be appreciated – if I posted this in the wrong section apologies.

    by DonJ at 2013-04-04 22:41:19

    As written, it isn't dividing out the MB. $_.VM / 1MB would do that. I'll add this to the book's errata.

    "F" means floating point, and "2" means 2 decimal places. Unfortunately those formatting strings aren't terribly well-documented. "N2" does something similar.

    by levi.rogers at 2013-04-05 07:33:59

    Thanks Don, I didn't think it was supposed to actually divide it out like the text said I just thought maybe I was really missing something there.

    Thanks again for your quick response on this. Also, I am loving the book and on a side note Chapter 9 was ground breaking for me – confusing as hell but ground breaking.

    by DonJ at 2013-04-05 07:39:36

    Thank you! (Which was chapter 9?) I'm really glad it's helping! Holler if you run into anything else!

You must be logged in to reply to this topic.