Skip to content

bug: PATH is replaced by InstallWizard, on Windows #7

Description

@ffunatsu

ProcessBuilder setxPb = new ProcessBuilder(
"setx", "PATH", "C:\\msys64\\mingw64\\bin;%PATH%");

This code replaces user's environment PATH on Windows 11, and not recoverable.
This would break everything else in environment, so I think this should be fixed at least on Windows.

(Please note that %PATH% is just text, not expanded, at least on Windows.)

Activity

  1. changed the title [-]bug: PATH is replaced by InstallWizard[/-] [+]bug: PATH is replaced by InstallWizard, on Windows[/+] on Oct 6, 2026
  2. ffunatsu commented on Oct 7, 2026

    @ffunatsu
    Author

    Probably the easiest way is to get System.getenv("PATH") but this is mixture of system PATH and user PATH, and too expanded.

  3. ffunatsu commented on Oct 7, 2026

    @ffunatsu
    Author

    This might work, but still untested.

    ProcessBuilder setxPb = new ProcessBuilder(
              "cmd.exe", "/C", "setx PATH \"C:\\msys64\\mingw64\\bin;%PATH%\"");
  4. ffunatsu commented on Oct 7, 2026

    @ffunatsu
    Author

    This might work, but still untested.

    Tested with groovysh, it seems working as an workaround. But I think this method is still dangerous for Windows developers.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions