home *** CD-ROM | disk | FTP | other *** search
- The purpose of this section is to achieve independence from drive letters.
- Besides not having to remember drive letters, this allows me to reorganize
- my logical drives to take best advantage of free space as I like without
- having to edit any batch files or aliases.
-
- Directory names cannot duplicate, however. This is usually not a problem
- if your directory names are meaningful.
-
- The first ingredient is a CDPATH set to run through all your hard drives.
- Here's how it is on my system:
-
- CDPATH=C:\;D:\;E:\;F:\;G:\;H:\;I:\;J:\
-
- Note the use of the ":\" to make sure we always start from the root looking
- for directories.
-
-
- ALIASES
-
- Thanks to Tom Rawson for the key alias ("in") in this section.
-
- IN=pushd %1^%2&^popd
- TAP=in tapcis tapcis q%&
- TC=in tc procomm
-
- The "IN" alias does a "pushd" to save the current drive and directory. PUSHD
- also walks down the CDPATH looking for a directory name match on the first
- word after "IN". Upon arrival, the remainder of the command line is executed.
-
- When the application program exits, POPD takes you back where you started.
-
- This is how I keep my PATH environment variable so short (see AUTOEXEC.ZIP).
- None of my utilities, no matter how stupidly written, need to have the PATH
- variable include their directories. The CDPATH setup keeps me from needing
- to know drive letters.
-
- Note, too, that this little trick can clean up a lot of junky little batch
- files that just change directory to the application and run it.
-
-
- FINDING DATA FILES
-
- Here's a batch fragment that figures out where a file is to copy for further
- processing. The same trick can be used in a number of ways to find a data
- directory without too much trouble.
-
- pushd tackett
- set dr=%@substr[%_cwd,0,2]
- popd
-
- After this fragment runs, the value of environment variable "dr" is equal
- to the letter of the drive containing directory "tackett" and the trailing
- colon (because the length argument to @substr = 2). "Dr" is used elsewhere
- in the batch file to tell the application where its data is.
-