Why is Path variable behaving like other user variables in “Edit environment variables for your account”?

I tried to add a path to the Path variable using chatgpt prompts (which I should not have done)

setx Path "%JAVA_HOME%\bin;%PATH%"

Now I can’t see the old path variables nor add new path variables. The system functions fine until now but I don’t know what I should do to revert back the behaviour.

  • BearOfaTime@lemm.ee
    link
    fedilink
    English
    arrow-up
    3
    ·
    11 months ago

    What do you mean acting like other user variables? Your screenshot shows a user variable.

    • spidermanOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      11 months ago

      Yes, Path is an user variable. Since it will have multiple path(s) there are options to add, delete, move path(s) but when you only have one path in the path variable, it will behave like other user variables. I learnt this from a mistake I made yesterday.

      • BearOfaTime@lemm.ee
        link
        fedilink
        English
        arrow-up
        2
        arrow-down
        1
        ·
        11 months ago

        Hmm, guess I don’t understand.

        There’s a system path, and a user-definable path as shown in the screenshot?

        We’re you just surprised there’s a user-definable path?

  • FooBarrington@lemmy.world
    link
    fedilink
    English
    arrow-up
    2
    ·
    11 months ago

    Maybe the variable is still available in a running program - do you have a terminal open? If so, try doing echo %PATH%.

    • spidermanOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      edit-2
      11 months ago

      The response was just %PATH%. The behaviour didn’t change even after restarting my pc.

      • FooBarrington@lemmy.world
        link
        fedilink
        English
        arrow-up
        2
        ·
        11 months ago

        You presumably executed that in PowerShell? In that case you’d have to use $env:PATH. But by rebooting you’ve removed the chance to access the previous value.

        • spidermanOP
          link
          fedilink
          English
          arrow-up
          1
          ·
          edit-2
          11 months ago

          Did I fuck it up seriously and there’s no way to reverse it back? The good thing is I can see all the variables and none of them were deleted when I tried echo $env:PATH. But I can’t keep using cli to change them forever.

          • FooBarrington@lemmy.world
            link
            fedilink
            English
            arrow-up
            3
            ·
            11 months ago

            It really depends on what extra stuff you had added there. In a normal installation, it shouldn’t be much - maybe some command line tools don’t work as expected, but those can be added back.

            I’d maybe suggest creating a new user, reading the PATH from that, and setting it on your profile (change any references to the new user to your old one). That should mostly reset things.

            • spidermanOP
              link
              fedilink
              English
              arrow-up
              1
              ·
              11 months ago

              I can’t do that since this is a work laptop with restrictions.

                • spidermanOP
                  link
                  fedilink
                  English
                  arrow-up
                  1
                  ·
                  edit-2
                  11 months ago

                  I don’t have a ControlSet002 folder on the HKEY_LOCAL_MACHINE

                  Update: I checked out ControlSet001 and it had all the previous path. I cannot copy them since I didn’t have enough permissions in my work laptop. But like I said in above comments, doing echo $:PATH displayed the previous path variables which I copied and pasted on the Path variable. I think adding multiple path variable enables the option to add, edit etc. Idk whether I recovered all the previous path variables but it’s just functioning fine.