Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!
Credits 2 Posts 1 Joined 2007-09-17 15:49 18-year member UID 97627 Gender Male
Status Offline
I'm sorry! I'm a newbie! I plan to create a batch file. It needs to add J:\Lotus\Notes\Data to the current PATH. Is there any senior brother to help?
From J:\Domino\Data;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Support Tools\;C:\Program Files\QuickTime\QTSystem\
To
J:\Domino\Data;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Support Tools\;C:\Program Files\QuickTime\QTSystem\;J:\Lotus\Notes\Data
Credits 9,023 Posts 5,017 Joined 2007-05-31 19:39 19-year member UID 89899 Gender Male
Status Offline
Originally posted by next45 at 2007-9-17 04:18 PM:
Sorry! I'm a newbie! I plan to create a batch file. It needs to add J:\Lotus\Notes\Data to the current PATH. Is there any senior to help
From
J:\Domino\Data;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Support Tools\;C:\Program Files\QuickTime\QTSystem\
To
J:\Domino\Data;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Support Tools\;C:\Program Files\QuickTime\QTSystem\;J:\Lotus\Notes\Data
Credits 42 Posts 17 Joined 2005-08-28 14:49 20-year member UID 42027
Status Offline
```
@echo off
Set /p Paths=Enter the "Path" path you want to add, separate multiple paths with ";" :
Set Regfile=HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
For /f "tokens=3" %%i in ('Reg Query "%Regfile%" /v path^|Find /i "REG_EXPAND_SZ"') Do Set Pathf=%%i
Reg add "%Regfile%" /v path /t REG_EXPAND_SZ /d %Pathf%;%Paths% /f>nul
```
Credits 916 Posts 377 Joined 2004-03-08 00:00 22-year member UID 19523 Gender Male
Status Offline
Hey, in Java teaching, there are always people who mess up the path system variable, which causes many program loading problems. But after looking at setx for a long time, I find that it only has the replace function and no append function, which makes it a bit troublesome.
Credits 1 Posts 1 Joined 2008-10-22 08:05 17-year member UID 129006 Gender Male
Status Offline
I used to use reg add/delete to modify the registry (in bat scripts) to add or delete environment variables before, but I found that after adding them, they don't take effect immediately and I need to restart the OS. I wonder if there is a way without restarting the OS.
Credits 2,025 Posts 1,122 Joined 2007-09-05 20:15 18-year member UID 96653 Gender Male
Status Offline
I used to use reg add/delete to modify the registry (in a bat script) to add or delete environment variables, but I found that after adding them, they don't take effect immediately and require a system restart. I wonder if there is a method that doesn't require restarting the OS.
You can use the command-line tool NirCmd to refresh the environment variables: NirCmd sysrefresh environment