Important Notice: On February 29th, this community was put into read-only mode. All existing posts will remain but customers are unable to add new posts or comment on existing. Please feel to join our Community Discord for any questions and discussions.

Setting Machine Level Environment Variables

Hi All,

Trying understand how to best set two(2) environment variables (machine level - HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment ).

The first is to update(if exists)/add the PROMPT variable to reflect ...
"$_[%COMPUTERNAME% - $D - $T]$_$P$G " (excluding double-quotes).

The second is to add a new environment variable (TAG) for all users to use (same HKLM key as above)

Should I use a Command or Powershell step to perform either or both and how best to perform these actions.

Cheers & thanks in advance,
Cam.

0

Comments

2 comments
Date Votes
  • You could do this with just a CMD step or through Powershell.  Either should work but Powershell would give you the greater flexibility for if something exist Prompt this or move on... 

    REG.EXE ADD "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" 

    after the " you could add what you need to change.
    1
  • Thanks for responding Dan.

    So for the PROMPT update I'd execute ...

    REG.EXE ADD "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v PROMPT /d "$_[%COMPUTERNAME% - $D - $T]$_$P$G " /f

    Sweet - many thanks.

    0