Just like any other environment variable, with SET
:
SET PATH=%PATH%;c:whateverelse
If you want to have a little safety check built in first, check to see if the new path exists first:
IF EXIST c:whateverelse SET PATH=%PATH%;c:whateverelse
If you want that to be local to that batch file, use setlocal
:
setlocal
set PATH=...
set OTHERTHING=...
@REM Rest of your script
Read the docs carefully for setlocal
/endlocal
, and have a look at the other references on that site - Functions is pretty interesting too and the syntax is tricky.
The Syntax page should get you started with the basics.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…