Skip to content

Harden Run-PATH-Repair-Admin.bat argument quoting for unusual repository paths #5

Description

@ekalb81

Problem

Run-PATH-Repair-Admin.bat builds the elevated PowerShell command as a formatted string:

PowerShell -NoProfile -Command "$scriptPath = $args[0]; $arguments = '-NoProfile -NoExit -File \"{0}\"' -f $scriptPath; Start-Process -FilePath 'PowerShell.exe' -Verb RunAs -ArgumentList $arguments" "%repair_script%"

Paths containing apostrophes or ampersands break this quoting and either fail or run a mangled command. (Also tracked in BACKLOG.md P3.)

Proposed fix

Replace the string-built command with an argument-array approach, e.g. pass the script path through $args all the way and use Start-Process -ArgumentList @('-NoProfile','-NoExit','-File', $scriptPath) so PowerShell handles quoting. Verify with repo paths containing spaces, apostrophes, and ampersands. Keep the launcher preview-only and preserve the visible UAC prompt.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions