CD!  an improved change directory command

ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³ CD! C:\MySub\MySub2 ³
³ CD! C:\MySub\       ³
³ CD! C:MySub         ³
³ CD! ..              ³
³ CD! D:\             ³
³ CD! D:              ³
³ CD! \               ³
³ CD!                 ³
³    ^watch the space ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ

Roedy Green
Canadian Mind Products
#101 - 2536 Wark Street
Victoria, BC Canada V8T 4G8
tel:(250) 361-9093
mailto:roedyg@mindprod.com
http://mindprod.com

This program is copyrighted but free.  The source and object
code may be used for any purpose except military.  You are free
to copy it, sell it, modify it, or cannibalize it.  You can take
out the credits if you want.  The only restriction, backed up by
Canadian Mind Products standard very nasty penalties is that you
must make sure none of it is ever used for a military purpose.

Purpose
=======

The CD command that comes with MS or PC DOS has three flaws:
1.  It does not set the ERRORLEVEL for Invalid directories.
2.  It fails when there is a trailing backslash on the name.
3.  You cannot hide its error messages with >NUL: redirection.

CD! acts just like CD except that it fixes these three problems.
CD! is slower since it is must be loaded each time, whereas CD
is internal to DOS.

Samples of Use
==============

CD! behaves just like the normal DOS CD command except that it
sets ERRORLEVEL to 1 if it fails because the directory requested
does not exist.

CD! C:\MYDIR\MYSUBDIR
IF ERRORLEVEL 1 ECHO missing directory

CD \MYDIR
CD! SUBDIR
IF ERRORLEVEL 1 ECHO missing directory

CD! \MYDIR\MYSUBDIR\
IF ERRORLEVEL 1 ECHO missing directory

CD! ..
IF ERRORLEVEL 1 ECHO already at the root

CD! D:\
REM changes the current directory on D: to the root

CD! D:
REM displays the current directory on D:

CD!
REM displays the current directory.

GETTING THE LATEST VERSION
**************************

Look for the latest version at my Web site:
  http://mindprod.com

It would also be helpful if you mentioned the URL or source of where
you got your copy.  I want to make sure that site is kept kept up to
date.

Rem -30-