Path: utzoo!utgpu!water!watmath!clyde!att!ucbvax!pasteur!ames!fxgrp!ljz From: ljz@fxgrp.UUCP (Lloyd Zusman) Newsgroups: comp.sys.ibm.pc Subject: Re: How to add to PATH on the fly? Message-ID: <724@fxgrp.UUCP> Date: 25 Jun 88 22:08:44 GMT References: <688@crcmar.crc.uucp> <6836@cup.portal.com> Reply-To: ljz%fx.com@ames.arc.nasa.gov (Lloyd Zusman) Organization: Master Byte Software, Los Gatos, California Lines: 53 In article <6836@cup.portal.com> Devin_E_Ben-Hur@cup.portal.com writes: To add additional directories to your path, make a batch file (ADDPATH.BAT): PATH %PATH%;%1 then invoke: ADDPATHYou can go a bit further with this. I seem to recall that the original poster also asked for a way to quickly revert back to the old path. Here are a couple of .BAT files that should do the job: First file, ADDPATH.BAT: set OLD_PATH=%PATH% :back if .%1==. goto done set PATH=%PATH%;%1 shift goto back :done Second file, OLDPATH.BAT: if .%OLD_PATH%==. goto done set PATH=%OLD_PATH% set OLD_PATH= :done You can then type ADDPATH foo bar baz to add the directories 'foo', 'bar', and 'baz' to your path. Typing OLDPATH will restore your old path. If you are running under DOS 3.30 or above, you can call these from within another batch file as follows: call ADDPATH mydir rem do whatever you want rem ... call OLDPATH -- Lloyd Zusman UUCP: ...!ames!fxgrp!ljz Master Byte Software Internet: ljz%fx.com@ames.arc.nasa.gov Los Gatos, California or try: fxgrp!ljz@ames.arc.nasa.gov "We take things well in hand."