(Image: Club Logo) HCC

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


Here are some methods for moving around directories, and two regarding the DOS Path statement.

1. To quickly go to the parent directory of any current directory, issue:

CD ..

To go to the grandparent directory of any current directory, issue:

CD ..\..

If you use 4DOS, it's even shorter:

CD ... Goes up two levels
CD .... Goes up three levels

2. To see the path statement, one may type:

PATH

However, if it's long, it may be hard to discern because each directory is separated by semicolons and there are no spaces:

PATH C:\;C:\DOS;C:\COMM\ARACHNE;C:\DOS\ANSIPLUS;E:\GRAPHICS\SEA

To make it more readable, use this batch file:


	:: PATHVIEW.bat
	::
	@ECHO OFF
	ECHO.
	FOR %%D IN (%PATH%) DO TYPE %%D
	ECHO.

The path statement will now appear as:


	C:\
	C:\DOS
	C:\COMM\ARACHNE
	C:\DOS\ANSIPLUS
	E:\GRAPHICS\SEA

3. There are a number of ways to add a directory to the path statement, but sometimes it's handy to be able to edit it directly. To do that, use this batch file:


	:: PATHEDIT.bat
	::
	@ECHO OFF

	PATH > EDPATH.BAT
	EDIT EDPATH.BAT
	CALL EDPATH.BAT

	ECHO.
	ECHO    The Path is Now:
	ECHO      %PATH%
	ECHO.

	DEL EDPATH.BAT

This batch file will send the current path statement, including the word "PATH", to "EDPATH.bat", which is then sent to DOS's text editor EDIT. After making changes, saving and exiting, this new version of EDPATH.bat is called. It will change the path statement to the edited version. The new path is displayed and EDPATH.bat is deleted since its work has been completed.

Be sure when editing to keep the path statement all on one line. In addition, this new path will be reset to the default after a reboot. To make it permanent, replace PATH in the start-up file, AUTOEXEC.bat, with the edited one.



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 & Tricks #2

Revert back to the: DOS Tips & Tricks Index

Back to the: Tips & Tricks Index

Home