Example:
HDD Capacity: " + "{0:N2}" -f
What does " + " do and what does it mean?
Learning powershell.
Thanks
Example:
HDD Capacity: " + "{0:N2}" -f
What does " + " do and what does it mean?
Learning powershell.
Thanks
Looks like you have an incomplete statement there. You're missing a leading quote and the actual data to the right of the -f (Format operator). When used with strings, + concatenates the strings:
PS > "HDD Capacity: " + "{0:N2}"
HDD Capacity: {0:N2}
PS >
The format operator will take that string (wnich can be coded as a single string) and fomrat the numerical value to the right to two decimal places:
PS > "HDD Capacity: {0:N2}" -f 365.987
HDD Capacity: 365.99
PS >
I used a hard-coded value here to focus on the action of the -f operator, but in practice, you would use a variable or expression that retrieves the hard drive capacity.