1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Adding to the path

Discussion in 'Support' started by CWBillow, Jun 17, 2009.

  1. CWBillow

    Joined:
    Jul 12, 2008
    Messages:
    194
    Likes Received:
    0
    How can I add a folder to the system path?

    Regards,
    Chuck Billow
     
  2. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,307
    Likes Received:
    39
    Not tested:

    Code:
    set /s path=%path;%newdir
    
    Or, if the current value of the PATH environment variable might differ from the system variable:

    Code:
    set /s path=%@regquery["HKLM\System\CurrentControlSet\Control\Session Manager\Environment\path"];%newdir
    
    Add a /E if you want your current path updated to reflect the new system path.
     
  3. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,959
    Likes Received:
    30
    On Wed, 17 Jun 2009 20:41:08 -0500, CWBillow <> wrote:

    |How can I add a folder to the system path?

    Manually? ... use the ControlPanel System applet ... Advanced ... Environment
    Variables

    or

    SET /S path=%path;new-dir
    --
    - Vince
     
  4. CWBillow

    Joined:
    Jul 12, 2008
    Messages:
    194
    Likes Received:
    0
    Thanks Charles, Vince.

    Regards,
    Chuck
     
  5. samintz

    samintz Scott Mintz

    Joined:
    May 20, 2008
    Messages:
    1,190
    Likes Received:
    11
    As you've already read, there are multiple ways to accomplish this.

    I assume you mean to change the PATH environment variable for the SYSTEM
    as opposed to the USER and have it take effect for all of Windows. If you
    just want to change it for your current TCC session it gets even easier.

    If you look up help on SET you can see there are a number of switches that
    effect what gets set.

    Display, create, modify, or delete environment variables.

    SET [/A /D /E /P /R file... /S /U /V /X] [name[=][value ]]
    file: One or more files containing variable definitions
    /A(rithmetic) /S(ystem variables)
    /D(efault variables) /U(ser variables)
    /E(nv vars) /V(olatile variables)
    /R(ead from file) /X override VariableExclude
    /P(ause)

    The SET /S command will set a value into the registry at the key
    "HKLM\System\CurrentControlSet\Control\Session Manager\Environment".
    The SET /U command will set a value into the registry at the key
    "HKCU\Environment"
    The SET /V command will set a value into the registry at the key
    "HKCU\Volatile Environment"
    The SET /D command will set a value into the registry at the key
    "HKU\.DEFAULT\Environment"

    Note that none of the above commands will modify your current TCC
    environment with the following caveat:
    If the "Update Environment on System Change" configuration option is set,
    TCC will monitor the WM_SETTINGCHANGE message and update the environment
    from the User, Volatile, and System registry entries. The update is done
    whenever TCC displays the prompt (to prevent the environment from changing
    in the middle of a command). Unless you have a specific need for this
    option it's better not to enable it, as it can result in variables set by
    TCC's parent process being destroyed.

    If you specify the /E switch in combination with the above switches, both
    the registry value and the current TCC environment will be set.

    If you just want to modify the current TCC environment you can use either
    ESET or SET.

    SET PATH=%PATH;new_path

    or ESET PATH

    -Scott

    CWBillow <> wrote on 06/17/2009 09:40:56 PM:


     
  6. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,520
    Likes Received:
    4
    samintz wrote:
    ...
    | If you just want to modify the current TCC environment you can use
    | either ESET or SET.
    |
    | SET PATH=%PATH;new_path
    |
    | or ESET PATH

    ... or use the PATH command, which is a legacy shorthand for "SET PATH":

    PATH %path;addition
    --
    Steve
     
  7. CWBillow

    Joined:
    Jul 12, 2008
    Messages:
    194
    Likes Received:
    0
    Great! Thanks Scott.

    Regards,
    Chuck
     

Share This Page