Skip to content
ScoopInstallerPublic

About

A Scoop helper program for shimming executables

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

131 stars

Watchers

12 watching

Forks

Latest commit

 

History

120 Commits

Folders and files

Shim

C# C++ Rust Zig

A tiny, fast launcher for Scoop, the Windows command-line installer. It reads a small .shim file, starts the tool it points to, and stays out of the way.

Four independent implementations -- C#, C++, Rust, and Zig -- with identical behavior.

Quick start

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

test.exe reads test.shim from the same directory. The file is found by replacing the executable's extension with .shim, or appending .shim when the name has none.

Shim file

path = C:\Apps\tool.exe
args = --quiet
env:APP_CACHE_DIR = %~dp0cache
env!:PATH = %PATH%;%~dp0
  • path is required. args, cwd, and elevate are optional.
  • env:NAME sets a default; an external value wins. env?:NAME is the same form.
  • env!:NAME forces a value. Use it for PATH changes or deliberate isolation.
  • %~dp0 means the shim's directory in path, and the target's directory elsewhere.

The shim waits for the child and forwards its exit code. See SPEC.md for the full format and rules.

Self-description

An unpaired shim.exe can report itself:

.\shim.exe --version
shim <version> (<impl>)
Features: cwd env env-force expand dp0 elevate

Only the canonical, unpaired shim.exe answers. A shim with a .shim file passes its arguments to the target.

An installed copy carries the same facts in its version resource, so it can be read without running the target:

(Get-Item .\foo.exe).VersionInfo | Select-Object ProductVersion, Comments

Implementations

Implementation impl Build Tool x86 x64 arm64
C# cs dotnet 24.5 KB 24.0 KB 24.0 KB
C++ cpp Zig 126.5 KB 150.5 KB 143.0 KB
C++ cpp MSBuild 129.5 KB 152.5 KB 133.0 KB
Rust rust Cargo 118.5 KB 137.0 KB 133.0 KB
Zig zig Zig 90.0 KB 77.5 KB 27.0 KB

impl is the token reported by self-description. Sizes are the current build output.

Documentation

Special Thanks

This repository builds on these earlier implementations:

  • 71/scoop-better-shimexe -- C implementation that solved Ctrl+C passthrough and dropped the .NET startup cost.
  • kiennq/scoop-better-shimexe -- C++ fork of 71's, adding MSBuild support and the cwd field to the shim format.
  • zoritle/rshim -- Rust implementation, memory safety and UTF-8 BOM handling.
  • svercl/zshim -- Zig port, showed a shim can be built with no runtime dependency.

License

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

You may choose either license.

About

A Scoop helper program for shimming executables

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

131 stars

Watchers

12 watching

Forks

Releases

Sponsor this project

Used by

Contributors

Languages