The High-Performance, Native C++20, Object Oriented Pipeline Shell & Scripting Engine for Windows.
RunicShell is an ultra-fast, lightweight, object-oriented shell and scripting runtime built from the ground up in modern C++20. It brings the expressive object pipeline semantics of PowerShell into a single-file, zero-dependency native Win32 binary with sub-5 millisecond startup times and minimal memory overhead.
RunicShell started off as a clone of KSH back in 2008 for an employer of mine who needed to run custom KSH scripts. It worked but just the few scripts I needed to have run. Fast forward to 2023 that company had gone out of business and I bought some of their machines that I was going to use for a custom Linux distribution that I was developing and I discovered they still ran that shell. After I got permission to release the shell under an open source license I started work on the shell again. We decided to rededicate the KSH shell to CrossShellKSH which is part of our CrossShell for UNIX product and decided to rewrite RunicShell as a complete Object Oriented shell starting in Febuary of 2025. We noticed that some complex scripts caused PowerShell to use huge amounts of RAM and we needed to run some legacy .bat and .cmd but we didnt want to have to run PowerShell and cmd.exe at the same time. Enter RunicShell. We have developed this shell to use native win32 objects, run cmd.exe scripts, run .ps1 scripts and a custom script called .ns1 and we use PowerShell syntax and commands.
Traditional administrative shells present a tradeoff:
-
PowerShell / PowerShell 7: Incredibly rich object pipeline and ecosystem, but heavy startup latency (.NET runtime initialization) and high working-set memory utilizing a slow startup and uses 20 - 60 MB of RAM.
-
CMD / Bash: Fast startup, but text-stream-only pipelines requiring fragile
grep,awk,findstr, or regex string scraping. -
** RunicShell is designed as a single source file for compiling on air gapped servers, Windows Server Core systems where the MSVC build kit is not included and is built with Clang it does not require Visual Studio IDE to build.
RunicShell bridges this gap:
- Instant Startup: Launches in under 5 ms.
- Ultra-Low Memory: Idle footprint under 12 MB RAM.
- Structured Object Pipelines: Native tabular data streams with typed cells, schema projection, and column-aware filtering.
- **Lazy Streaming: Evaluates pipelines record-by-record and short-circuits instantly (e.g.
Get-ChildItem -Recurse C:\Windows | select -First 3returns in milliseconds without building multi-gigabyte in-memory tables). - Single-File Source: The entire core engine is self-contained in a single source file (
rurunsh.cpp) with zero third-party dependencies.
- Piped Tables (
DataTable): Output is not unstructured text; cmdlets return structured tables with typed columns. - Lazy Evaluation: Streaming chunk pipeline architecture allows producers (
Get-ChildItem,Get-Process,Get-Service) to stream records directly into downstream filters (Where-Object,Select-Object -First N). - Instant Short-Circuiting: Early termination signaling (
isHalted) halts upstream filesystem / API iteration immediately upon reaching consumer limits. - Property Name Parameter Binding: Cmdlets automatically inspect incoming table columns and bind properties (
PID,ProcessName,Name,FullName,Path,JobId, etc.) directly to their target parameters.
Over 150+ high-performance native cmdlets across key administrative domains:
- Hardware & Telemetry:
Get-ComputerInfo,Get-Disk,Get-Volume,Get-CpuSummary,Get-PhysicalMemory,Get-GpuInfo,Get-AudioDevice,Set-AudioVolume,Get-DisplayMonitors,Get-SystemPowerStatus,Get-CpuCoreTopology,Get-TpmStatus. - System Administration:
Get-Process,Stop-Process,Wait-Process,Get-Service,Start-Service,Stop-Service,Restart-Service,Get-ServiceStatus,Get-StartupProgram,Get-WindowsVersion,Get-HotFix,Get-Uptime. - Filesystem & Providers:
Get-ChildItem(with-File,-Directory,-Recurse,-Hidden),Get-Content,Set-Content,Get-FileSize,Test-Path,Split-Path,Resolve-Path,Invoke-Item,Remove-Item,Sync-Directory. - Virtual Drive Providers: Virtual drive providers for
FileSystem,Registry(HKLM:,HKCU:,HKCR:,HKU:,HKCC:),Certificate(Cert:),Environment(Env:), andVariable(Variable:). - Modern CIM & WMI:
Get-CimInstance,Get-CimClass,New-CimSessionvia native COMIWbemServices. - Network & Diagnostics:
Test-NetConnection(tnc),Resolve-DnsName,Get-DnsRecord,Get-NetworkAdapter,Get-NetIPAddress,Get-NetTCPConnection,Get-NetUDPEndpoint,Test-Ping. - Data Serialization & Formatting:
Import-Json,ConvertFrom-Json,ConvertTo-Json,Import-Csv,Export-Csv,ConvertTo-Csv,ConvertFrom-Csv,ConvertTo-Html,ConvertTo-Markdown,Select-Xml,Format-Table,Format-List,Format-Wide,Select-Object,Where-Object,Sort-Object,Measure-Object,Group-Object,Out-File. - Security & Cryptography:
Get-FileChecksum,Get-FileHash,Test-FileSignature,Get-AuthenticodeSignature,Get-LocalUser,Set-LocalUser,Get-LocalGroup,Get-Secret,Set-Secret,Get-TokenPrivilege,Unlock-BitLocker,Import-Certificate.
- Complete Job Control Suite:
Start-Job(sjob),Get-Job(jobs),Foreground-Job(fg),Background-Job(bg),Suspend-Job(suspendjob),Resume-Job(resumejob),Wait-Job(wjob),Receive-Job(rcjob),Stop-Job(spjob),Remove-Job(rmjob). - POSIX / Shell
&Background Operator: Append&to any pipeline or command line (e.g.Get-Process &) to instantly spawn it as an asynchronous background job. - Flexible Job References: Reference jobs by numeric ID (
1), job specifier (%1), current job (%+), previous job (%-), or job name. - Thread-Safe Runtime: Thread pool execution with atomic state tracking, thread-safe stdout capture, cancellation tokens, and clean shutdown guarantees.
- Script Modules (
.ns1/.ps1/.runsh): Modular scripts with custom functions, parameter declarations, and exported symbols. - Native C ABI Binary Modules (
.dll): Write high-performance C/C++ plugins. Uses a pure C ABI boundary (RurunshPluginHeader,RurunshPluginContext, opaque table handles) guaranteeing cross-CRT and cross-compiler version heap safety (STATUS_HEAP_CORRUPTIONimmune).
- Multi-Format Script Support: Natively execute
.ns1,.ps1,.bat, and.cmdscripts directly, through pipelines, or via cmdlets (Run-Script,Invoke-BatchFile). - Native AST Engine (
.runsh1/.ps1): Complete scripting runtime with control flow (if/elseif/else,for,foreach,while,do..while,try/catch/finally), custom functions withparam(...)blocks, default arguments, switch parameters, return values, and structured error handling. - Transparent Batch Bridge (
.bat/.cmd): Runs Windows batch files with automatic argument forwarding, pipeline stream capture, exit code preservation ($LASTEXITCODE,$?), and two-way environment variable synchronization (set VAR=valinside batch immediately syncs back to$env:VARand the shell runtime).
- Pre-Deployment Linter (
Test-Script): Test and analyze scripts (.ns1,.ps1) before deployment. Catches syntax mistakes, unclosed quotes/braces, unresolved cmdlets, destructive actions without safety guards (Remove-Item -Recurse), and plaintext passwords, providing clear line-by-line mitigation advice. - Persistent Event Journal (
~/.rurunshevtlog): Automatically records session startups, non-terminating errors, runtime exceptions, and fatal crash details into a local diagnostic file (%USERPROFILE%\.rurunshevtlog). - Built-in Diagnostic Suite:
Show-ShellEventLog(runshevtlog): View recent shell errors and events with-Tail <N>support.Clear-ShellEventLog(clearevtlog): Reset the event log and start fresh.Show-ShellDiagnostics(shelldiag): View real-time process ID, memory usage, thread count, and user privileges.Invoke-SelfTest(shell-test): Run built-in regression sanity checks on the core shell engine.
RunicShell was created by me for me, AI is used for documentation, security checks and code review. AI generated code accounts for approximately 12 to 15 percent of the code. 29,000 lines of code was written by me over a 3 year period, AI helped with cmdlet implementations, security checks and hardening.
A Windows Installer package (RunicShell.msi) is available to install RunicShell (nsh.exe) directly into System32\ (C:\Windows\System32):
- Download or locate
RunicShell.msi. - Run the installer and accept the BSD 3-Clause license agreement.
- Once installed,
nshis immediately available globally in your PATH (System32):nsh
msiexec.exe /i RunicShell.msi /qn /norestart- Windows 10, Windows 11, or Windows Server 2022/2025 x64 (ARM coming soon).
- Microsoft Visual C++ (MSVC)
cl.exe(via Visual Studio 2019/2022 or Build Tools) supporting C++20.
RunicShell compiles as a single translation unit with zero external libraries:
# Compile with MSVC (cl.exe / vcc)
cl.exe /std:c++20 /bigobj /EHsc /O2 /utf-8 /Fe:rurunsh.exe rurunsh.cpp ws2_32.lib iphlpapi.lib winhttp.lib crypt32.lib bcrypt.lib advapi32.lib user32.lib shell32.lib ole32.lib oleaut32.lib taskschd.lib netapi32.lib wtsapi32.lib wintrust.lib setupapi.lib cfgmgr32.lib powrprof.lib virtdisk.lib wbemuuid.lib dxgi.lib.\nsh.exe
# Or simply 'nsh' if installed via MSI to System32.\nsh.exe -Command "Get-Service | where Status -eq Running | select -First 5"# RunicShell / PowerShell native scripts
.\nsh.exe -File script.ns1
.\nsh.exe -Command ".\deploy.ps1 -Environment Production"
# Windows Batch / CMD scripts
.\nsh.exe -Command ".\build.bat Release x64; echo ExitCode=$LASTEXITCODE; echo EnvVar=$env:BUILD_STATUS"Search a large directory hierarchy and abort immediately once 3 matching entries are found:
Get-ChildItem -Recurse C:\Windows | Where-Object Extension -eq ".dll" | select -First 3Query running services and inspect their status:
Get-Service | where Name -eq "wuauserv" | Get-ServiceStatusInspect file sizes of all Markdown documents in the directory:
Get-ChildItem -File *.md | Get-FileSizeFind a process and stop it:
Get-Process | where ProcessName -like "notepad" | Stop-ProcessExport process telemetry to JSON and re-import directly into structured pipelines:
Get-Process | Select -First 5 | ConvertTo-Json | Out-File "processes.json"
Import-Json -Path "processes.json" | Where { $_.WorkingSet_MB -gt 50 } | Format-TableEnumerate auto-run programs directly from the Registry provider:
Get-ChildItem "HKLM:\Software\Microsoft\Windows\CurrentVersion\Run"Spawn background tasks, inspect status, and manage execution interactively:
# Launch in background with '&' or Start-Job:
Get-ChildItem -Recurse C:\Windows | Measure-Object &
$job = Start-Job -ScriptBlock "Get-Service | Where Status -eq Running" -Name SvcJob
# List active and completed jobs (or 'jobs -l' for elapsed time details):
jobs
jobs -l
# Bring a background job to foreground and receive output:
fg %1
# Or by job name:
fg SvcJob
# Suspend and resume jobs:
Suspend-Job %1
Resume-Job %1
bg %1
# Retrieve buffered job data and clean up:
Receive-Job %1 -AutoRemove
Stop-Job -AllQuery system BIOS and OS metadata natively via COM:
Get-CimInstance -ClassName Win32_OperatingSystem | Format-List
Get-ComputerInfoSeamlessly execute PowerShell, RunicShell, and legacy Windows Batch scripts side-by-side with full environment synchronization:
# Run native .ns1 or .ps1 scripts
.\maintenance.ns1
Run-Script -Path .\setup.ps1
# Run .bat or .cmd batch scripts directly or with Invoke-BatchFile
.\build.bat Release
Invoke-BatchFile -Path .\setenv.bat -ArgumentList "PROD_SERVER"
# Batch environment changes and exit codes are immediately available
Write-Host "Batch Exit Code: $LASTEXITCODE"
Write-Host "Synced Environment Variable: $env:PROD_SERVER"
# Pipe batch script output directly into RunicShell object filters
.\diagnostics.bat | Select-Object -First 10 | Out-File "diag.txt"Analyze scripts before running them in production and monitor shell health:
# Test a script file before deployment
Test-Script .\deploy.ns1
# Test an in-memory scriptblock
Test-Script -ScriptBlock 'Write-Host "Deploying..."; Remove-Item C:\Temp\* -Recurse; $pwd = "secret123"'
# View recent errors and events from ~/.rurunshevtlog
Show-ShellEventLog -Tail 5
# Clear event log
Clear-ShellEventLog
# Inspect shell performance & working set memory
Show-ShellDiagnosticsRunicShell features a pure C ABI plugin system. Plugins can be compiled with any MSVC or C++ compiler version without heap corruption.
#define RUNSH_PLUGIN_EXPORT __declspec(dllexport)
#include <cstdint>
struct RurunshPluginHeader {
uint32_t apiVersion;
const char* moduleName;
const char* moduleVersion;
const char* author;
const char* description;
};
struct RurunshPluginContext {
void* engineHandle;
void (*RegisterCmdlet)(void* engine, const char* name, const char* alias, const char* category, const char* help, void* handler);
void* (*CreateTable)();
void (*AddColumn)(void* table, const char* colName);
void (*AddRow)(void* table, const char* const* values, uint32_t count);
};
typedef void* (*RunshCmdletHandler)(const char* const* args, uint32_t argc, void* inTable, const RurunshPluginContext* ctx);
extern "C" {
RUNSH_PLUGIN_EXPORT RurunshPluginHeader RurunshPluginHeaderInfo = {
1, "MyPlugin", "1.0.0", "RunicShell Developer", "Sample Native Binary Plugin"
};
void* NativeGreetingHandler(const char* const* args, uint32_t argc, void* inTable, const RurunshPluginContext* ctx) {
void* table = ctx->CreateTable();
ctx->AddColumn(table, "Message");
const char* row[1] = { "Hello from native compiled MSVC C++ plugin!" };
ctx->AddRow(table, row, 1);
return table;
}
RUNSH_PLUGIN_EXPORT bool RurunshInitPlugin(const RurunshPluginContext* ctx) {
ctx->RegisterCmdlet(ctx->engineHandle, "Get-NativeGreeting", "greeting", "Plugin", "Returns native plugin message", (void*)NativeGreetingHandler);
return true;
}
}# Compile DLL
clang.exe /std:c++20 /LD /O2 /EHsc /utf-8 /Fe:MyPlugin.dll MyPlugin.cpp
# Import and execute inside RunicShell
.\nsh.exe -Command "Import-Module .\MyPlugin.dll; Get-NativeGreeting"- Cmdlet Reference Manual: Comprehensive catalog of all 150+ built-in cmdlets, aliases, categories, and parameters.
- Scripting Language & Migration Reference: Full scripting language specification, expressions, control flow, functions, and PowerShell-to-RunicShell conversion guide.
- Custom Cmdlets & Plugin Guide: Deep dive into creating script modules (
.ns1,.runsh) and native C ABI binary plugins (.dll).
RunicShell is open-source software licensed under the BSD 3-Clause License.