Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!uwm.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!hplabs!hpfcso!hpfinote!pnl From: pnl@hpfinote.HP.COM (Peter Lim) Newsgroups: comp.sys.ibm.pc Subject: 4DOS can do 'cd -' !! Message-ID: <19450047@hpfinote.HP.COM> Date: 6 May 90 01:16:53 GMT Organization: Hewlett Packard CICD Lines: 24 Someone suggested how to implement 'cd -' as swd (see below) under 4DOS. I tried it; it works and I went one step further and alias 'cd' so that 'cd -' will do the same as it does under UNIX. Just place the following 2 lines in file XXXX and do alias /R XXXX under 4DOS and you're in business. It will work across drives. swd set _d1=%_cwd^popd^set _d2=%_cwd^*cdd %_d1^pushd %_d2^unset _d1 _d2 cd iff "%1"=="-" then swd^elseiff "%1"=="" then *cd^else *pushd %1^endiff One minor bug, it doesn't track where you're going when you change drive without using 'cd' (ie. when you do 'e:' or 'c:' etc). Anyone one to fix that too ? Regards, ## Life is fast enough as it is ........ Peter Lim. ## .... DON'T PUSH IT !! >>>-------, ########################################### : E-mail: plim@hpsgwg.HP.COM Snail-mail: Hewlett Packard Singapore, : Tel: (065)-279-2289 (ICDS, ICS) | Telnet: 520-2289 1150 Depot Road, __\@/__ ... also at: pnl@hpfipnl.HP.COM Singapore 0410. SPLAT !