Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

How 2 add directory to PATH from command line (Users)

posted by Rugxulo Homepage, Usono, 07.01.2013, 22:33

> EDIT: Never mind! After first posting this I think I just remembered the
> name of that command: APPEND! But now, I don't know how to delete my
> post. Is there a way to do that?
> ----------------------------------------------------------------------------
>
> Today I'm trying to figure out a shortcut for adding a directory to an
> already lengthy PATH statement.

No, I don't think APPEND is what you want. Also keep in mind that a PATH can only be approx. 128 bytes long, at least in most common environments (like your MS-DOS 6.21).

From cmdline, you can change the PATH easily, as mentioned, but most shells, including MS-DOS 6.21's, don't always expand env. vars when setting other environment variables. So "path c:\temp;%PATH%" doesn't work in MS-DOS 6.x (but works in 7.x's COMMAND.COM, IIRC). The workaround is to use a .BAT, since it always works inside there.

In my case, since I sometimes muck with the PATH and want to revert to a known stable state, I keep a file called MYPATH.BAT which switches back to the standard setup. In fact, I even call it from within AUTOEXEC.BAT:

REM N.B. this way avoids hardcoding the filename twice

for %%a in (c:\utils\mypath.bat) do if exist %%a call %%a


And here's MYPATH.BAT:


@echo off
REM mypath.bat
path c:\;c:\fdos\bin;c:\hx\bin;c:\utils
if not "%1"=="" path %PATH%;%1

 

Complete thread:

Back to the forum
Board view  Mix view
22762 Postings in 2122 Threads, 402 registered users (0 online)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum