ScoopInstaller/Shim

A Scoop helper program for shimming executables

118

stars

43

commits

Zig

primary language

Sep 4, 2026

updated

scoop
scoop-helper
Browse cluster: Windows Package Management Tools

README

Shim

C# C++ Rust Zig

A small program that launches the executable specified in its paired <name>.shim file. A helper for Scoop, the Windows command-line installer.

Shim File Format

path = <path to executable>
args = <arguments>
cwd = <working directory>
elevate = true|false|1|0|yes|no
NAME = <environment variable override>

Comments

Lines starting with #, ;, or //, as well as blank lines, are ignored.

Fields

FieldDescription
path(Required) Path to the target executable
argsArguments passed to the target
cwd (workdir)Working directory for the target process
elevate (runas)Request UAC elevation. Valid values: true, 1, yes
Any other nameEnvironment variable set for the target process

Value Quoting

Values may be wrapped in double quotes (e.g. path = "C:\Program Files\app.exe") or left unquoted.

Variable Expansion

  • %ENV% — Expands environment variables in path, args, cwd, and environment override values. Unknown variables (e.g. %NONEXISTENT_VAR%) are preserved as-is.
  • %~dp0 — Expands to the directory containing the target executable with a trailing backslash. Applies to args and cwd only (not path).

Argument Parsing

User-provided runtime arguments are appended after those defined in args.

Environment Variables

Any line whose key is not path, args, cwd, workdir, elevate, or runas is treated as an environment variable override for the child process. Keys are case-insensitive.

Exit Codes

The shim waits for the child process to finish and forwards its exit code. If the shim fails internally, it exits with code 1.

Usage

The .shim file must share the same base name as the shim.exe.

New-Item -Path test.shim -Value 'path = C:\Windows\System32\calc.exe'
Copy-Item -Path .\cpp\bin\x64\shim.exe -Destination .\test.exe
.\test.exe

Implementations

  • C# — .NET Framework 4.5 (CLR).
  • C++ — Native executable with no runtime dependencies. Zig build (default).
  • Rust — Native executable using windows-sys raw FFI bindings. Cargo build.
  • Zig — Native executable using custom wWinMainCRTStartup entry. Zig build only.

All implementations share the same .shim format.

Binary Size

ImplementationBuild Toolx86x64arm64
C#dotnet16.0 KB15.0 KB15.0 KB
C++Zig117.0 KB141.5 KB133.0 KB
C++MSBuild116.0 KB140.5 KB122.5 KB
RustCargo113.0 KB130.5 KB126.0 KB
ZigZig81.5 KB72.0 KB21.5 KB

Startup Latency

Benchmarked with C:\Windows\System32\whoami.exe (built-in) via hyperfine — 20 warmup + 50 measured runs per implementation (randomized order). Architecture: x64.

ImplementationMean [ms]vs DirectExtra [ms]
direct89.9 ± 39.71.00
C#113.8 ± 11.41.27× ± 0.57+23.9
C++176.1 ± 33.71.96× ± 0.94+86.2
Zig178.6 ± 32.91.99× ± 0.95+88.7
Rust193.0 ± 24.02.15× ± 0.99+103.2

All shims share the same .shim format overhead; variance is dominated by process creation and file I/O. C# benefits from the CLR already being warm in typical Scoop sessions.

Development

All build.ps1 scripts accept -Target x86|x64|arm64 and -Configuration Debug|Release (default Release). Output is written to bin/{Target}/shim.exe.

Special Thanks

This repository builds upon the work of several independent projects that pioneered faster, more reliable Scoop shims:

  • 71/scoop-better-shimexe — The groundbreaking C implementation that solved Ctrl+C passthrough and eliminated .NET startup overhead.

  • kiennq/scoop-better-shimexe — C++ fork of 71's work, adding MSBuild support and the cwd field to the shim format.

  • zoritle/rshim — Rust implementation focused on memory safety and proper UTF-8 BOM handling.

  • svercl/zshim — Pure Zig port that proved a shim can be built with zero runtime dependencies.

License

This project is dual-licensed under the Unlicense or the MIT License.

You may choose either license.

Contributors

niheaven

21 commits

lukesampson

7 commits

r15ch13

6 commits

chawyehsu

3 commits

ScoopInstaller/Shim

A Scoop helper program for shimming executables

118

stars

43

commits

Zig

primary language

Sep 4, 2026

updated

scoop
scoop-helper
Browse cluster: Windows Package Management Tools

README

Shim

C# C++ Rust Zig

A small program that launches the executable specified in its paired <name>.shim file. A helper for Scoop, the Windows command-line installer.

Shim File Format

path = <path to executable>
args = <arguments>
cwd = <working directory>
elevate = true|false|1|0|yes|no
NAME = <environment variable override>

Comments

Lines starting with #, ;, or //, as well as blank lines, are ignored.

Fields

FieldDescription
path(Required) Path to the target executable
argsArguments passed to the target
cwd (workdir)Working directory for the target process
elevate (runas)Request UAC elevation. Valid values: true, 1, yes
Any other nameEnvironment variable set for the target process

Value Quoting

Values may be wrapped in double quotes (e.g. path = "C:\Program Files\app.exe") or left unquoted.

Variable Expansion

  • %ENV% — Expands environment variables in path, args, cwd, and environment override values. Unknown variables (e.g. %NONEXISTENT_VAR%) are preserved as-is.
  • %~dp0 — Expands to the directory containing the target executable with a trailing backslash. Applies to args and cwd only (not path).

Argument Parsing

User-provided runtime arguments are appended after those defined in args.

Environment Variables

Any line whose key is not path, args, cwd, workdir, elevate, or runas is treated as an environment variable override for the child process. Keys are case-insensitive.

Exit Codes

The shim waits for the child process to finish and forwards its exit code. If the shim fails internally, it exits with code 1.

Usage

The .shim file must share the same base name as the shim.exe.

New-Item -Path test.shim -Value 'path = C:\Windows\System32\calc.exe'
Copy-Item -Path .\cpp\bin\x64\shim.exe -Destination .\test.exe
.\test.exe

Implementations

  • C# — .NET Framework 4.5 (CLR).
  • C++ — Native executable with no runtime dependencies. Zig build (default).
  • Rust — Native executable using windows-sys raw FFI bindings. Cargo build.
  • Zig — Native executable using custom wWinMainCRTStartup entry. Zig build only.

All implementations share the same .shim format.

Binary Size

ImplementationBuild Toolx86x64arm64
C#dotnet16.0 KB15.0 KB15.0 KB
C++Zig117.0 KB141.5 KB133.0 KB
C++MSBuild116.0 KB140.5 KB122.5 KB
RustCargo113.0 KB130.5 KB126.0 KB
ZigZig81.5 KB72.0 KB21.5 KB

Startup Latency

Benchmarked with C:\Windows\System32\whoami.exe (built-in) via hyperfine — 20 warmup + 50 measured runs per implementation (randomized order). Architecture: x64.

ImplementationMean [ms]vs DirectExtra [ms]
direct89.9 ± 39.71.00
C#113.8 ± 11.41.27× ± 0.57+23.9
C++176.1 ± 33.71.96× ± 0.94+86.2
Zig178.6 ± 32.91.99× ± 0.95+88.7
Rust193.0 ± 24.02.15× ± 0.99+103.2

All shims share the same .shim format overhead; variance is dominated by process creation and file I/O. C# benefits from the CLR already being warm in typical Scoop sessions.

Development

All build.ps1 scripts accept -Target x86|x64|arm64 and -Configuration Debug|Release (default Release). Output is written to bin/{Target}/shim.exe.

Special Thanks

This repository builds upon the work of several independent projects that pioneered faster, more reliable Scoop shims:

  • 71/scoop-better-shimexe — The groundbreaking C implementation that solved Ctrl+C passthrough and eliminated .NET startup overhead.

  • kiennq/scoop-better-shimexe — C++ fork of 71's work, adding MSBuild support and the cwd field to the shim format.

  • zoritle/rshim — Rust implementation focused on memory safety and proper UTF-8 BOM handling.

  • svercl/zshim — Pure Zig port that proved a shim can be built with zero runtime dependencies.

License

This project is dual-licensed under the Unlicense or the MIT License.

You may choose either license.

Contributors

niheaven

21 commits

lukesampson

7 commits

r15ch13

6 commits

chawyehsu

3 commits

Languages

Zig

27.4%

PowerShell

25.0%

Rust

16.3%

C#

16.0%

C++

15.3%