Options
All launcher options precede --. Values use Windows double-quote/backslash rules. Every option that takes a value accepts both --name VALUE and --name=VALUE, such as --priority=below-normal or --env=NAME=VALUE. Repeating an option uses its last value; --env keeps the last value per case-insensitive name.
--stdout FILE: redirect standard output to a file; overwrite by default. Missing parent directories are created. The path can hold<date>,<time>,<program>and<pid>: see One file per run.--stderr FILE: redirect standard error and launcher diagnostics to a file; overwrite by default once stream setup reaches it. Diagnostics before stream setup append to preserve earlier messages. An error in the options can use only a--stderrparsed before that error. Missing parent directories are created.--append: append both redirected files. Each write appends, including writes from descendants.--overwrite: overwrite both redirected files (default). The last append/overwrite flag wins regardless of its position.--max-size SIZE: cap the redirected files of an--appendrun. Before the child starts, a--stdoutor--stderrfile larger thanSIZEis moved to the same name with.1added, such asjob.log.1, replacing an older backup, and the run appends to a new file. So a job that runs every few minutes for months keeps at most about twiceSIZEper stream, and the output of the run that crossed the cap is still there.SIZEis a byte count or a number withK,MorG(alsoKB/KiBand so on, all 1024-based), such as10M.noneturns off a default set by theoutput.maxSizeconfig key for this run;0is refused. A file that cannot be moved, because another program holds it without delete sharing, is appended to as it is, with a diagnostic on the--stderrdestination. Without--appendthe option does nothing, since each run replaces the file. The idea comes fromSilentCMD’s/LOGSIZE, which truncates the file instead.--cwd DIR: set the child’s working directory. It must exist: a missing directory is a launcher failure (125), so a mistyped path never runs the job in a fresh empty folder. Relative output paths resolve against the launcher’s working directory, independently of this option.--create-cwd: create the--cwddirectory, with its parents, when it is missing.--env NAME=VALUE: override one inherited environment variable; repeat for more variables. Values may contain=. An empty value sets an empty variable; it does not remove the name. The parent’s environment stays unchanged.--priority CLASS: start the child in a process priority class:idle,below-normal,normal,above-normal,highorrealtime. Omitted, Windows chooses as usual:normal, or the launcher’s own class when that isidleorbelow-normal. A priority class only orders who runs first when processors are contended; it is not a CPU cap, and a low-priority child still uses an idle processor fully.realtimepreempts the threads of every other process, including system tasks, so a busy realtime child can leave the mouse unresponsive and disk caches unflushed, freezing the desktop; without the “Increase scheduling priority” privilege Windows starts it athighinstead. An enclosing job with a priority limit overrides the requested class.--timeout DURATION: wait at most a positive duration withms,s,morhsuffix, such as250ms,0.5s,30m,1h. Fractions round up to milliseconds. Maximum:4294967294ms(about 49.7 days). Timing begins after process creation. Expiry terminates the job and returns 124.--detach: return 0 after successful process creation, without creating a launcher-owned job. Cannot combine with--timeout. The child can outlive the launcher; an enclosing job imposed by the caller still applies. Redirect output to files for unattended use: inherited pipes remain open in the child and may keep the caller waiting for EOF.--engine NAME: run the program under this engine instead of the one its extension picks, such as--engine powershellfor Windows PowerShell 5.1. See Programs and scripts.--force-engine: with--engine, run the program even when the engine does not accept its extension.--config FILE: read engines and output defaults from this file too, over the system and global ones. See Configuration.--elevate: run the child elevated, as an administrator. See Elevation.--tray[=true|false|auto]: a notification-area icon while the job runs, to view its output, open its logs or stop it. The default,auto, shows it for a run started on a desktop and not under Task Scheduler, a service or--detach. See Tray icon.--event-log: write the run’s outcome to the Windows Application event log. See Event log.--echo: start nothing, and show what the launcher received and what it would start. See Checking what a caller passes.--help: print usage and exit 0. Use--stdout FILEto view it when no output handle exists.--version: print the version and exit 0. Supports--stdout FILEtoo.
One file per run
Section titled “One file per run”A --stdout or --stderr path can hold placeholders, which the launcher fills in when it starts:
<date>: the launcher’s start date, local time, asyyyy-MM-dd, such as2026-11-21.<time>: its start time, local time, asHH-mm-ss, such as07-30-00.<program>: the program’s file name without its extension, such asbackupforC:\Scripts\backup.ps1.<pid>: the launcher’s process id, which tells apart two runs started in the same second.
So a scheduled task can keep each run’s output, with no wrapper script, although Task Scheduler expands nothing in its Add arguments field:
--stdout "C:\Logs\<program>.<date>.<time>.log" --stderr "C:\Logs\<program>.<date>.<time>.log" -- C:\Scripts\backup.ps1Names are case-insensitive, and a placeholder may appear in a directory part too, such as C:\Logs\<date>\<program>.log, whose missing directory is created. < and > cannot appear in a Windows file name, so a placeholder never collides with a real path and no escape is needed: a < or > that does not form a known placeholder is a launcher failure (125). From cmd or PowerShell, quote the path, since both shells read a bare < or > as a redirection. Under --elevate the elevated copy uses the unelevated launcher’s start time and process id, so both name the same file. The pair with --max-size is the choice between one file per run and one capped file appended to. The idea comes from hide-win32-console-window, which names each run’s log after the program and its start time.
Standard handles
Section titled “Standard handles”Unredirected standard handles are inherited when available and otherwise connect to NUL. Standard input follows that rule too. If stdout and stderr name the same absolute path, both share one file handle. Files open with read/write/delete sharing; only --max-size rotates them, and only before the child starts.
Checking what a caller passes
Section titled “Checking what a caller passes”Put --echo first and keep the rest of the call as it is. The launcher parses its options as usual, resolves the engine and interpreter, and then starts nothing. It shows:
- the command line it received, and that line split into arguments;
- the child tail after
--, forwarded unchanged; - the engine and interpreter the tail’s program picks, or that the program runs directly;
- the exact command line the child would be started with, split into the arguments a C program would receive;
- the
--cwddirectory and the--envoverrides, when given.
Each argument is shown in brackets, 3: [a b], so an empty argument and leading or trailing spaces stay visible. For a .cmd or .bat file the split shown is the tail’s, since cmd.exe runs the tail as a command rather than splitting it.
The text goes to the first place that can take it:
- the file named by
--stdout FILE; - a redirected standard output, such as
headless-run --echo -- tool.exe "a b" | more; - the console of the shell that started the launcher;
- a window, when there is no console at all: a shortcut, the Run dialog or Explorer.
The window shows the same text, and below it the received command line in a box you can edit. The arguments under that box are split again on every keystroke, by the same C runtime rule, so you can try a variant of the line, an added quote or a doubled backslash, where it actually runs. Ctrl+C copies the selection, or the whole box when nothing is selected; Tab moves between the boxes, and Esc or Close ends the launcher.
Under Task Scheduler with no desktop there is nowhere to show it, so pass --stdout FILE there. The exit code is 0, or 125 when the child command line cannot be built, for example when the engine’s interpreter is not installed; the reason is then part of the text. --echo with no -- shows the launcher’s own arguments only.
Because a Windows-subsystem program does not hold the console, the text printed to a console can appear after the shell’s next prompt. Pipe it, as in item 2, or use start "" /wait in cmd, to keep it in order.