how do I retrieve a value after using setx?

from the doc (setx /? )

Because SETX writes variables to the master environment in the
registry, edits will only take effect when a new command window is
opened – they do not affect the current CMD or PowerShell session.

Leave a Comment