How 2 add directory to PATH from command line (Users)
> Is there a command in MS-DOS 6.21 that I can use to temporarily "insert" or
> "add-on" a directory to the existing PATH statement?
I am not near a PC, so from memory:
set oldpath=%path%
path=%path%;c:\testdir1;c:\testdir2
[do testing]
path=%oldpath%
set oldpath=
First line will backup the path to a temporary environment variable (providing you have room in the environment, if not you can always expand it). Second line adds 2 new directories onto the end of the path. Do testing line speaks for itself, 3rd line restores original path and 4th line removes temporary oldpath variable. Depenfing on what your doing not all the lunes ate required and a quick trick is to start a new command.com session, change the path then just do an exit when done.
Most of my batch files were designed to not require external programs if I could help it hence until you mentioned append I'd completely forgotten about it. A simple way of checking if the environment is big enough to backup another copy of the path is to do an if check like this:
if NOT "%path%"=="%oldpath%" goto PATHERROR
Re your autoexec.bat question I used to make mine runable again by doing a simple check if it had already run, e.g
if NOT "%booted%"=="" GOTO rerun
:firstrun
set booted=1
rem do 1st boot stuff e.g load keybd tsr
goto end
:rerun
set path=c:\dos;c:\bcc
goto end
:end
> The reason I want to do this is to try out a program. So I don't want to
> update the path statement in my AUTOEXEC.BAT file until I decide whether or
> not I'll continue to use this new program.
Complete thread:
- How 2 add directory to PATH from command line - CluelessInSeattl, 07.01.2013, 17:19 (Users)
![Open in board view [Board]](img/board_d.gif)
![Open in mix view [Mix]](img/mix_d.gif)
- How 2 add directory to PATH from command line - Arjay, 07.01.2013, 18:05
- How 2 add directory to PATH from command line - marcov, 07.01.2013, 18:22
- How 2 add directory to PATH from command line - Arjay, 07.01.2013, 22:07
- How 2 add directory to PATH from command line - marcov, 07.01.2013, 18:22
- How 2 add directory to PATH from command line - Rugxulo, 07.01.2013, 22:33
- How 2 add directory to PATH from command line - marcov, 09.01.2013, 16:55
- How 2 add directory to PATH from command line - Arjay, 07.01.2013, 18:05
Mix view