PowerShell
v7.1.4
PowerShell
v7.1.4
PowerShell is a cross-platform task automation framework from Microsoft consisting of a command-line shell and a scripting language built on .NET. Originally released for Windows in 2006 as Windows PowerShell, it was reimagined as the open-source, cross-platform PowerShell (formerly PowerShell Core) in 2016, running on Windows, macOS, and Linux.
Unlike traditional text-based shells, PowerShell is object-oriented: cmdlets pass structured .NET objects through the pipeline rather than plain strings, which makes filtering, sorting, and formatting precise. It is used heavily for system administration, configuration management, CI/CD automation, and cloud operations, and it can call into the full .NET API as well as native commands.
Write-Output "Hello, World!"$name = Read-Host "Enter your name"
Write-Output "Hello, $name!"foreach ($n in 1..4) {
Write-Output ($n * $n)
}function Add-Numbers($a, $b) {
return $a + $b
}
Write-Output (Add-Numbers 2 3)$ages = @{ alice = 30; bob = 25 }
$ages["carol"] = 28
foreach ($key in $ages.Keys) {
Write-Output "$key is $($ages[$key])"
}$nums = 1..10
$nums |
Where-Object { $_ % 2 -eq 0 } |
Sort-Object -Descending |
ForEach-Object { Write-Output $_ }$people = @(
[PSCustomObject]@{ Name = "Alice"; Age = 30 }
[PSCustomObject]@{ Name = "Bob"; Age = 25 }
)
$people | Where-Object { $_.Age -gt 26 } | Select-Object Nametry {
$result = 10 / 0
} catch {
Write-Output "Caught error: $($_.Exception.Message)"
} finally {
Write-Output "Done"
}$value = "hello"
switch -Wildcard ($value) {
"h*" { Write-Output "starts with h" }
"*o" { Write-Output "ends with o" }
default { Write-Output "no match" }
}$fruits = "apple", "banana", "cherry"
$fruits += "date"
for ($i = 0; $i -lt $fruits.Count; $i++) {
Write-Output ("{0}: {1}" -f ($i + 1), $fruits[$i])
}Yes. CompileBytes runs your PowerShell scripts in the browser, so you don't need to install PowerShell on your machine.
The compiler reports PowerShell 7.1.4, the cross-platform edition built on .NET.
Use Read-Host to prompt for and capture a line of user input into a variable.
Yes, running PowerShell on CompileBytes is free, and PowerShell itself is open-source under the MIT license.
PowerShell passes structured .NET objects through the pipeline instead of plain text, making it easier to filter, sort, and format command output.