Windows PowerShell

Implementation of programming language PowerShell

Windows PowerShell is the main implementation of PowerShell language, developed by Microsoft and available on Windows platform.

Examples:

Hello, World!:

Example for versions Windows PowerShell 5.0
Echo "Hello, World!"

Factorial:

Example for versions Windows PowerShell 5.0
function Get-Factorial ($n) {
    if ($n -eq 0) {
        return 1
    }
    $fact = 1
    1..$n | ForEach { $fact *= $_ }
    return $fact
}

foreach ($i in 0..16) {
    echo ("{0}! = {1}" -f $i,(Get-Factorial $i))
}

Fibonacci numbers:

Example for versions Windows PowerShell 5.0
function Get-Fibonacci ($n) {
    if ($n -le 1) {
        return 1
    }
    return (Get-Fibonacci ($n - 1)) + (Get-Fibonacci ($n - 2))
}
$output = ""
foreach ($i in 0..15) {
    $output += ("{0}, " -f (Get-Fibonacci $i))
}
echo "$output..."