]> vilimpoc.org git repositories - dotfiles/commit
dotfiles: stop the UAC launch line mangling its own arguments
authorMax Vilimpoc <max@vilimpoc.org>
Sat, 29 Aug 2026 17:17:40 +0000 (19:17 +0200)
committerMax Vilimpoc <max@vilimpoc.org>
Tue, 1 Sep 2026 10:53:18 +0000 (12:53 +0200)
commit422ce8c735062050411d37ea8958eb3f71a42eea
treefddb28ac47a26a2598e52d7c22e23ad8533ba89c
parent99725a30bdb3eee44c38e1fd9a28c060341aa058
dotfiles: stop the UAC launch line mangling its own arguments

Adding -TraceUser to the elevated launch gave it a second quoted argument, and
the ""..""  doubling used to get quotes through cmd only survives ONE.  With
two, the quote-state parsing merges the tail into the -File value, so the
elevated PowerShell was handed

    -File "C:\...\setup-windows-with-uac.ps1 -TraceUser LATISLAB\Claude "

and refused it -- "failed because the file does not have a '.ps1' extension" --
exiting -196608 (0xFFFD0000) before Start-Transcript could run.  The batch file
then reported no elevated log and guessed at a cancelled UAC prompt, which is
the one thing that had not happened.

Both values now travel in the environment and the quotes the child needs are
built as [char]34 inside PowerShell, so the command line in the batch file
carries no quote characters of its own beyond the outer pair.

Exercised through cmd against a probe script in a directory with a space in its
name: -File binds, -TraceUser arrives as LATISLAB\Claude, and the child's exit
code still propagates.  Against the real script with -Verb RunAs dropped, it now
gets as far as the #Requires elevation check, which is where a non-elevated run
should stop.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YMh8i2QzkHNdE3MkKfcaT6
setup-windows.bat