Adding to the path

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,461
88
Albuquerque, NM
prospero.unm.edu
How can I add a folder to the system path?

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.
 
May 20, 2008
11,400
99
Syracuse, NY, USA
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
 
Jul 12, 2008
286
0
Las Vegas, NV
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.

Thanks Charles, Vince.

Regards,
Chuck
 

samintz

Scott Mintz
May 20, 2008
1,503
16
Solon, OH, USA
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:


> How can I add a folder to the system path?
>
> Regards,
> Chuck Billow
>
>
>
>
 
May 20, 2008
3,515
4
Elkridge, MD, USA
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
 
Similar threads
Thread starter Title Forum Replies Date
C Fixed V25 crashes when adding and then removing in the tabbed toolbar Support 3
I zip /M fails to delete file after adding to zip file Support 2
M Bug in Windows 10, when adding symbol to task bar Support 6
rps Fixed V17 @name adding quote (") to result Support 5
T How to? Adding TCC to startup folder Support 6
nickles Passing a variable to a command w/o adding it to the local environment Support 7
williamleara Can't Close TakeCommand After Adding 2nd Toolbar Tab Support 3
Jay Sage Issue With Adding Buttons to Toolbar in Build 30 Support 0
V Set path permanently from within TCC? Support 3
Jay Sage Command Will Not Run Using Short Name of Path Support 5
Joe Caverly PUSHD with UNC path in CMD.EXE Support 2
MickeyF Why doesn't my python program get executed without specifying its path? Support 2
M How to set Path variable for non-executable file extensions in 4DOS Support 8
D How to? Path problems in TCC20 Support 1
vefatica "COMSPEC path" Support 2
Patulus TCHistoryLog: TCC: (Sys) The system cannot find the path specified Support 15
vefatica If there's no PATH variable ... Support 5
D V19: toolbar /r "path\tctoolbar.ini" Support 1
C ECHOing the _CWD with a & in the path Support 7
David McClelland How to? Path Changes Support 4
gschizas Fixed Cannot use extended path to delete invalid file Support 3
nickles Fixed In batch files, %0 now evaluates to the absolute path Support 9
cgunhouse IFTP Path Issue in V17 - Fixed Support 7
M How to? List path getting short file and directory names... Support 10
M How to? Get both path to and target of symbolic link/junction... Support 2
N Command completion and PATH Support 0
noahcoad How to? Create shortcut with env var in path Support 4
Exolon Space within path and FOR Support 4
A WAD Dir daterange + multiple path wildcards crashes tcc Support 2
D TCC can't start app if @shfolder[42] used for path Support 1
fpefpe How to? Path(s) for Python Support 0
D TPIPE works without being in path, but not V; aemail Support 8
Stefano Piccardi IDE.exe start toobar button fails when % in script path Support 0
H 12.10 UNZIP ignores destination path spec Support 2
Phileosophos unzip not using specified path Support 5
D Extracting the current command line, extracting current path Support 4
Stefano Piccardi char class wildcard issue when [] in path Support 14
D Function to see if a UNC path is mapped? Support 9
williamleara Specifying path to TCMD.INI causes issues Support 8
hrensink Path length limit Support 9
D D:\Settings\Application contains an incorrect path? Support 0
M TCC cannot find the path specified Support 4
P Too much path in path Support 12

Similar threads