{"id":77905,"date":"2016-04-17T11:59:08","date_gmt":"2016-04-17T18:59:08","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/?p=77905"},"modified":"2019-02-18T09:10:48","modified_gmt":"2019-02-18T16:10:48","slug":"powertip-use-powershell-to-display-a-percentage-that-has-two-decimal-places","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/powertip-use-powershell-to-display-a-percentage-that-has-two-decimal-places\/","title":{"rendered":"PowerTip: Use PowerShell to display a percentage that has two decimal places"},"content":{"rendered":"<p><strong>Summary<\/strong>:\u00a0Use Windows PowerShell to display a percentage as a two place number.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/q-for-powertip.jpg\" alt=\"Hey, Scripting Guy! Question\" \/>\u00a0How can I use Windows PowerShell to display a number as a percentage that has two decimal places?<\/p>\n<p style=\"padding-left: 30px\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/a-for-powertip.jpg\" alt=\"Hey, Scripting Guy! Answer\" \/>\u00a0Use the <strong>-f<\/strong> format specifier, and specify a pattern as <strong>\u201c{0:p2}\u201d<\/strong>. On the other side of the <strong>-f<\/strong> format specifier, perform your percentage calculation. Here is an example:<\/p>\n<p style=\"padding-left: 90px\">PS C:\\&gt; &#8220;{0:p2}&#8221; -f (1\/10)<\/p>\n<p style=\"padding-left: 90px\">10.00 %<\/p>\n<p style=\"padding-left: 30px\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/7610.Dr.ScriptoForTips.jpg\" alt=\"The Doctor\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Summary:\u00a0Use Windows PowerShell to display a percentage as a two place number. \u00a0How can I use Windows PowerShell to display a number as a percentage that has two decimal places? \u00a0Use the -f format specifier, and specify a pattern as \u201c{0:p2}\u201d. On the other side of the -f format specifier, perform your percentage calculation. Here [&hellip;]<\/p>\n","protected":false},"author":596,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[568,639,641],"tags":[164,398,356,3,45],"class_list":["post-77905","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-hey-scripting-guy","category-powertip","category-windows-powershell","tag-math","tag-numbers","tag-powertip","tag-scripting-guy","tag-windows-powershell"],"acf":[],"blog_post_summary":"<p>Summary:\u00a0Use Windows PowerShell to display a percentage as a two place number. \u00a0How can I use Windows PowerShell to display a number as a percentage that has two decimal places? \u00a0Use the -f format specifier, and specify a pattern as \u201c{0:p2}\u201d. On the other side of the -f format specifier, perform your percentage calculation. Here [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/77905","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/596"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=77905"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/77905\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/87096"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=77905"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=77905"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=77905"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}