Scripting Blog

A place to learn about PowerShell and share stories of automation

PowerTip: Use PowerShell to display a percentage that has two decimal places

Summary: Use Windows PowerShell to display a percentage as a two place number.  How can I use Windows PowerShell to display a number as a percentage that has two decimal places?  Use the -f format specifier, and specify a pattern as “{0:p2}”. On the other side of the -f format specifier, perform your percentage calculation. Here is an ...

Calculate percentage character frequencies from a text file by using PowerShell

Summary: Learn how to use Windows PowerShell to calculate the percentage of how often a character appears in a text file. This is the fifth post in a multi-part series of blog posts that deal with how to determine letter frequency in text files. To fully understand this post, you should read the entire series in order. Here are the posts in ...

Weekend Scripter: Approximate the Value of Pi from a Polygon

Summary: Microsoft senior software engineer, Firaz Samet, shows how to use Windows PowerShell to approximate the value of pi from a polygon. Microsoft Scripting Guy, Ed Wilson, is here. Today we have a guest blog post from Firaz Samet in honor of Pi (π) Day. I will turn the blog over… The Scripting Guy ran across my PowerShell Math ...

Weekend Scripter: PowerShell Does Scientific Notation

Summary: Microsoft PFE and guest blogger, Clint Huffman, talks about scientific notation and Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. Today we have another guest blogger from the past—Clint Huffman. The keyboard is yours Clint… In Performance Monitor, if a number in a field is too large to display, ...