Contents of the GO.DOC file
Goto specified drive/directory command
Placed in the Public Domain by
Ver. 3.0 July 1991
(See end of file for version history)
GO allows changing the default drive and/or current directory within
a single command line. The syntax is extremely flexible:
GO may be used like the standard CD command to change the current
directory of the default drive. GO also permits use of the '/'
symbol in place of '\'. The following statements are equivalent:
GO can also be used to change the default (logged) drive:
will all switch to D: as the default drive placing you in the current
directory last defined for that drive. With GO the colon (:) is
To change both the default drive and its current directory, enter the
full pathname as follows:
go d: bin\utils
go d \bin\utils
go d bin\utils
As you can see, GO is very flexible concerning the drive and
directory delimiters. The rules are simple and there is only one
To delimit the drive specifier, use a colon (:) or one or more spaces
after the drive letter.
To delimit the directory pathname, use a slash (/), backslash (\),
one or more spaces, or nothing in front of the pathname.
The single prohibition is a drive letter followed immediately by a
slash (or backslash) character. There must be a colon or a space
between a drive letter and the start of the directory pathname.
Each time GO is invoked, it will set an environmental variable (LDIR)
to contain the full drive/pathname of the current active directory.
When GO is invoked with no parameters it will change to LDIR. Thus,
typing GO with no target pathname will return you to the last active
drive and directory. Typing GO a second time (with no target
pathname) takes you back to where you had just come from. Used this
way, GO acts as a toggle between two different drive/directories.
With this feature, GO can also be used in batch files to record the
current "home" directory, perform additonal directory changes, and
return "home" upon completion of the batch file. To do this, use GO
to make the first directory change - this stores the "home" directory
in LDIR. Subsequent directory changes are made with the standard DOS
command CD, rather than GO. (This preserves the value of LDIR.)
Before exiting the batch file, invoke GO one more time with no target
pathname - this will change directory back to "home" as defined in
CAUTION: To keep the size of GO.EXE to a minimum, there is no error
checking performed when SETting the DOS environment. You should
insure that your environment area is large enough to hold the LDIR
variable string. The easiest way to do this is by adding a SET
command to your autoexec.bat file:
If this statement is executed before loading any programs that remain
resident (MODE, PRINT, GRAPHICS, etc.), DOS will expand the
environment area to accommodate it.
(Another way to expand the environment is via the SHELL= statement in
your CONFIG.SYS file. Refer to your DOS manual.)
SUGGESTION: Because GO is an external executable program, it takes
longer to invoke than DOS's internal CD. If you use a RAM disk on
your system, the performance of GO can be greatly improved by placing
GO.EXE in that drive and including the drive letter in your standard
The original version of GO employed an undocumented DOS interrupt
call (2eH) to modify the master DOS environment. It appears that
certain operating environments (such as 4DOS and NDOS) do not support
this mode of operation very well. As an alternative, you can now
trigger GO to use a safer (albeit slower) method - keeping track of
the last directory in a disk file (vs. the DOS environment).
To use the new method, simply create an environmental variable called
GODIR - for GO DIRECTORY. The variable should define the path and
filename you want to use to store the "last directory" information.
will instruct GO to look in the C:\BIN directory for a file called
DIRFILE. This will be the file that stores your last active
drive/directory. If GODIR is found in the DOS environment, GO will
use the disk file method. If not found, GO will use the faster DOS
Suggestion for RAM disk users: You will enjoy a significant increase
in performance by storing both GO.EXE and your "last directory" disk
file in the RAM drive.