(Image: Club Logo) HCC

DOS TIPS & TRICKS #2
For the:
Halifax Computer Club
Halifax, Nova Scotia, Canada


1. I dislike extra typing, so I try to combine operations whenever I can. This is a quickie batch file which allows the user to create a directory and then change to it with one command. To finish up, a "DIR" listing displays the new directory.

	:: MCD.bat
	:: Makes, and Changes to, a New Directory
	::
	@ECHO OFF

	MD %1
	CD %1
	DIR

To make a directory called "TEST" below the current directory, simply issue "MCD TEST". TEST will be created and the user deposited into it with the empty directory shown.

2. A good DOS rule is to keep the path short so that DOS will have fewer directories through which to look when it has to do an operation requiring directory perusing. However, for some operations, it is handy if the parent directory's files are always accessible to DOS. You may include any parent directory in the path by having `..\' in the PATH statement. As an example:

PATH=C:\BATCH;C:\DOS;..\

Dos uses `.' and `..' to mean the current and parent directory, respectively. So `..' is always the directory above the current one regardless of drive or directory. An exception is the root directory. There are none above the root.

3. The `..' trick can be used to change directories to a sister one.

	:: CDSW.bat
	:: Changes Directories Sideways
	::
	@ECHO OFF

	CD ..\%1
	DIR

If the current directory has subdirectories called "TEST1" and "TEST2", and you have changed to TEST1, type "CDSW TEST2" and you will be whisked into that directory. "DIR" will display the files and any subdirectories contained therein.

4. Finally this month, if one wishes to place comments into CONFIG.sys or AUTOEXEC.bat, one may use the "REM" (Remark) command. However, I find lines starting with "REM" to be confusing. To clean them up and make for a better read, try starting any comments in CONFIG.sys with a `;' (semicolon) and a space.

In AUTOEXEC.bat (or any batch file) start them with `::' (double colon) and a space. These comments will not show on screen nor will they be executed by DOS.



The Power is at the Command Line!

Richard Bonner is a DOS power user and has his own DOS website:

The DOS Operating System



Forward to: DOS Tips #3

Revert one back to: DOS Tips & Tricks #1

Revert back to the: DOS Tips & Tricks Index

Back to the: Tips & Tricks index

Home