Welcome to XCODX Online Compiler
Quick Start:
Ctrl+Enter Run code
Ctrl+S Save / Download
Ctrl+L Clear output
Select a language and start coding.
Welcome to XCODX Online Compiler
Quick Start:
Ctrl+Enter Run code
Ctrl+S Save / Download
Ctrl+L Clear output
Select a language and start coding.
PowerShell outgrew Windows years ago. Since going open source and cross-platform in 2016, it has become a first-class automation shell on Linux and macOS too, and current releases (PowerShell 7.4 LTS and 7.5, built on modern .NET) are what Microsoft ships for Azure Cloud Shell, CI pipelines, and infrastructure automation. Its defining idea still sets it apart from every other shell: pipelines pass structured .NET objects, not raw text, so you filter and transform data with properties instead of fragile string parsing. Sysadmins, DevOps engineers, and security analysts use it daily. This page runs PowerShell in a genuine interactive terminal — Read-Host actually waits for your keyboard, and output streams the moment each line executes.
$name = Read-Host "What is your name"
Write-Host "Welcome, $name!"
$limit = [int](Read-Host "List primes up to what number")
$primes = foreach ($n in 2..$limit) {
$isPrime = $true
for ($d = 2; $d * $d -le $n; $d++) {
if ($n % $d -eq 0) { $isPrime = $false; break }
}
if ($isPrime) { $n }
}
Write-Host "Primes up to ${limit}: $($primes -join ', ')"
Write-Host "Found $($primes.Count) of them."
PowerShell fluency is a baseline requirement for Windows sysadmin and DevOps roles, and increasingly for cloud engineering — Azure automation, Microsoft 365 administration, and Intune scripting all assume it. This page suits practicing the language layer: pipeline logic, Where-Object and ForEach-Object, hashtables, functions, and error handling with try/catch. It is also useful for certification prep (AZ-104 style scripting questions) and for Mac or Linux users who need to check syntax without installing pwsh. Note that machine-management cmdlets like Get-Service target the sandbox, not your PC.
Yes — this is a real terminal session, so Read-Host displays its prompt and blocks until you type a response and press Enter, while earlier Write-Host output has already streamed to the screen. You can build scripts with several sequential prompts and watch each answer get processed live.
It is cross-platform PowerShell (the pwsh 7.x line) running on Linux, not the legacy Windows-only 5.1. Language behavior is nearly identical for scripting practice, and 7.x adds niceties like the ternary operator, pipeline chain operators (&& and ||), and ForEach-Object -Parallel.
Modules that require Windows (Active Directory, registry, WMI/CIM against Windows) or an installed gallery module (Az, Microsoft.Graph) are not available — there is no Install-Module in the sandbox. Built-in cmdlets, the full language, string/collection handling, and .NET class access via [System.*] types all work.
main.ps1shellRead-Host# PowerShell Script
Write-Host "Hello from PowerShell!"
Write-Host "Welcome to XCODX Online Compiler!"
# Array operations
$numbers = 1..10
Write-Host "Numbers: $numbers"
$sum = ($numbers | Measure-Object -Sum).Sum
Write-Host "Sum: $sum"
# Hashtable
$info = @{
Name = "XCODX"
Type = "Compiler"
Languages = 85
}
foreach ($key in $info.Keys) {
Write-Host " $key = $($info[$key])"
}