A single-file Windows wrapper that launches a target program with Unicode-safe arguments and no console window flash. Built for use from the Explorer right-click menu, but works anywhere.
When a Windows registry context menu entry runs a script, four things go wrong:
| Problem | Effect |
|---|---|
| PowerShell 5.1 converts args through the ANSI code page | C:\Тест\файл.txt → C:\???\????.txt |
%1 in the registry can give 8.3 short paths |
C:\Dossier Été\ → C:\DOSSIE~1\ |
| Console programs flash a black window on every click | ~50–200 ms flicker, ugly |
wscript.exe hides the window but reintroduces ANSI corruption |
back to ? characters |
eupb.exe is a GUI-subsystem executable that receives its arguments in
UTF-16 (via CommandLineToArgvW), re-escapes them per the Microsoft
C/C++ command-line rules, and launches the target via CreateProcessW
with CREATE_NO_WINDOW. The arguments survive end-to-end.
eupb [OPTIONS] -- <TARGET> [TARGET_ARGS...]
The -- is recommended whenever the target or its args may look like
eupb options.
| Option | Default | Effect |
|---|---|---|
--hide-console |
on | Launch the target with CREATE_NO_WINDOW |
--show-console |
Keep the target's console visible | |
--wait-exit (alias --wait) |
Wait for the target to exit, propagate its exit code | |
--no-wait |
default | Launch detached, return 0 immediately |
--cwd <DIR> |
inherit | Working directory for the target |
--show-errors |
on | Show a MessageBox on launch errors |
--quiet-errors |
Suppress error dialogs; use exit codes only | |
--log <FILE> |
Log invocation details (UTF-8 + BOM) | |
--set-env NAME=VALUE |
Set or override an env var for the target. Repeatable. | |
--canonicalize |
Resolve symlinks and normalize the target path. On Windows this adds a \\?\ extended-length prefix — may break Electron apps (VS Code, VSCodium, etc.). |
|
--version, -V |
Show version | |
--help, -h |
Show help |
Some shells re-interpret the arguments they receive. Most notably,
powershell.exe -Command <string> concatenates everything that follows
into a single expression that its own language parser evaluates — so a
path like C:\Tom & Jerry\ep.txt, passed as a positional argument, gets
split on & and treated as two commands.
--set-env NAME=VALUE plants the value in the child process's
environment before CreateProcessW, so no shell parser ever touches
it. The registry entry reads its own $env:NAME (or %NAME%) instead
of a positional arg:
@="\"C:\\Tools\\eupb.exe\" --wait-exit \"--set-env=EUPB_PATH=%V\" -- powershell.exe -NoProfile -Command \"Set-Clipboard -Value $env:EUPB_PATH\""Note: --wait-exit is required here. The default --no-wait launches the child
as DETACHED_PROCESS which has no message loop — Set-Clipboard silently does
nothing in that context. Any command that writes to the clipboard needs --wait-exit.
--set-env can be repeated. Overrides of existing variables are
case-insensitive (Windows env semantics). Invalid pairs (missing =
or empty NAME) cause exit 1.
| Code | Meaning |
|---|---|
| 0 | Success (or target's exit code when --wait-exit) |
| 1 | Usage error (no target) |
| 2 | Target program not found |
| 3 | CreateProcessW failed |
| 4 | Wait / exit-code retrieval failed |
Add "Run my script" to the right-click menu for files:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell\MyScript]
@="Run my script"
"Icon"="C:\\Tools\\eupb.exe"
[HKEY_CLASSES_ROOT\*\shell\MyScript\command]
@="\"C:\\Tools\\eupb.exe\" -- powershell.exe -NoProfile -File \"C:\\Scripts\\my-script.ps1\" \"%V\""See examples/ for ready-to-import .reg files.
cargo build --release
The release binary lands at target\release\eupb.exe. The application
manifest (long-path awareness, Win10/11, asInvoker, UTF-8 active code
page) is embedded automatically by build.rs.
cargo test
Runs 3 library smoke tests, 29 unit tests for escape_arg
(table-driven, including a CommandLineToArgvW round-trip) and
52 integration tests spawning eupb.exe → eupb-test-target.exe across
ASCII, Cyrillic, CJK, emoji, French accents, apostrophes,
trailing-backslash-plus-space, UNC long paths, --no-wait, --cwd,
--log, PATH+PATHEXT resolution, and the full --set-env matrix
(Unicode values, shell metacharacters, multiple overrides,
case-insensitive replacement, parent-env preservation, and error paths).
- Windows 10 22H2 / Windows 11
- Rust 1.78+ with the
x86_64-pc-windows-msvctarget (for building)
Version 0.8.0 was a .NET Framework 4.x / C# implementation (project
name: "UBP"). The C# sources are preserved under
archive/dotnet/. Version 0.1.0 onward is a Rust
rewrite with the new project name eupb (Explorer Unicode Path
Bridge).