- Published date
PowerShell functions vs mise: why -- breaks

If mise resolves to a PowerShell function instead of mise.exe, -- no longer marks end of options. Explains the parsing layers and the workarounds.
The sharp edge I hit
In a PowerShell session where mise resolved to a function wrapper (shell integration), I expected this to behave like a typical CLI:
mise exec bun -- bun buildInstead, the -- boundary did not behave the way I expected.
Two reliable workarounds:
-
Call the executable explicitly:
mise.exe exec bun -- bun build -
Or pass a single command string:
mise exec bun -c "bun build"
This post is the “why” behind that.
PowerShell has two argument worlds
PowerShell is not just a string-forwarding shell. It is a language runtime with its own parsing and parameter binding.
When you type a command, PowerShell first resolves what that command is:
- Cmdlet
- Function
- Script (
.ps1) - Native executable (
.exe)
That classification changes how arguments are interpreted.
Calling a PowerShell command (function/cmdlet/script)
For PowerShell commands, PowerShell:
- Parses tokens as PowerShell syntax.
- Runs parameter binding (named parameters like
-Name value, switch parameters, positional binding). - Invokes the command with bound parameters and any remaining positional arguments.
For functions and scripts, whatever is not bound is what ends up in $args. That means your original token stream is not guaranteed to arrive intact.
Calling a native executable (.exe)
For native executables, PowerShell still parses quoting and expressions (because it is PowerShell), but it does not do PowerShell-style parameter binding.
It constructs a native argument list and starts a process.
This is why native tools usually see --, --flag=value, and other POSIX-style conventions the way you intended: they arrive as argv entries.
Why mise can be confusing on Windows
Mise typically installs a PowerShell function as part of shell integration (often via your profile). That function can shadow the mise.exe executable.
To see what you are actually invoking:
Get-Command mise | Select-Object Name, CommandType, SourceIf CommandType is Function, then mise is not the executable. You are invoking PowerShell code first.
That is not a bug. It is convenient for integrations. The important part is that it changes argument handling and forwarding.
Why -- did not protect the rest
In many CLIs, -- means “end of options; everything after this is positional”.
That meaning is not provided by the shell. It is implemented by the program that receives argv.
When mise resolves to a PowerShell function, there are three layers involved:
- PowerShell parses my command line into tokens (as PowerShell syntax).
- The
misefunction receives a PowerShell array of strings ($arguments). - The function forwards those strings to the real
mise.exe.
-- only has meaning at layer 3 (inside mise). It does not act as a “stop parsing” marker at layer 1.
PowerShell has its own rules, and a bare -- is not special in the way it is in POSIX-style CLIs.
You can see this in the actual mise pwsh integration. The wrapper is an advanced function that captures “remaining arguments” and then forwards them to the executable:
(In the generated activation script, {exe} is substituted with the full path to the mise executable.)
function mise {
[CmdletBinding()]
param([Parameter(ValueFromRemainingArguments=$true)][string[]] $arguments)
$command = $arguments[0]
$remainingArgs = $arguments[1..($arguments.Length - 1)]
& "{exe}" $command @remainingArgs
}Source: https://github.com/jdx/mise/blob/v2025.12.13/src/shell/pwsh.rs
The important part is not that the wrapper is “wrong”. It is that my command line has already been interpreted by PowerShell before $arguments exists.
That is why -- could not “protect” the rest of the tokens from PowerShell’s parser the way it can in shells that treat -- as a generic end-of-options delimiter.
I originally looked at PowerShell’s stop-parsing token (--%) as a possible escape hatch. In this specific case it did not help. Both mise exec bun --% bun build and mise.exe exec bun --% bun build failed, and in my environment they triggered a panic in mise at runtime (Rust/Tokio).
What works reliably
Option 1: call the executable explicitly
mise.exe exec bun -- bun buildBecause PowerShell recognizes mise.exe as a native executable, it uses the native invocation path (no PowerShell parameter binding). This is the simplest “make it behave like a normal CLI” move.
Option 2: use -c/--command and pass one command string
mise exec bun -c "bun build"This avoids the multi-layer “args plus -- plus args” forwarding problem. You are not asking PowerShell to preserve a complex argv boundary across layers. You are asking mise to run a command.
This is particularly useful in CI and bootstrap scripts where the shell integration function may or may not exist.
-- is a tool convention, not a PowerShell guarantee.