powershell number format with commas

How can I get this to display on one line with commas in the numbers?
write-host Processing Record# $recnum of $TotalRecordCount

I've only found examples like this:
http://technet.microsoft.com/en-us/library/ee692795.aspx

I do not know how to use those examples inline with text, only on single lines.
thanks
LVL 1
johnj_01201Asked:
Who is Participating?
 
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
Simply use
write-host ("Processing Record# {0:N0} of {1:N0}" -f $recnum, $TotalRecordCount)

Open in new window

0
 
Jeremy WeisingerSenior Network Consultant / EngineerCommented:
It depends on where you're using it but generally you would insert something like this:

("{0:N0}" -f $a)

Open in new window

$a can be any variable that contains a number or you can just write the number itself.
0
 
Raheman M. AbdulSenior Infrastructure Support Analyst & Systems DeveloperCommented:
$numbers = $recnum, $TotalRecordCount

"Processing  Record# {0:N0} of {1:N0} " -f $numbers
0
 
johnj_01201Author Commented:
The write-host example is what I need, and the $numbers examples is cool - I did not know we could do that. The write-host example is also like C code too which is another help. The $numbers example is a little beyond how I currently think- putting 2 numbers into one number, which I'm guessing is a PS object which explains why it works.
THANK YOU!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.