Dec 192017
 
Updated version of Change Directory that now works on networks. Returns an errorlevel if change was unsuccessful. Very good.
File CHGDIR15.ZIP from The Programmer’s Corner in
Category Batch Files
Updated version of Change Directory that now works on networks. Returns an errorlevel if change was unsuccessful. Very good.
File Name File Size Zip Size Zip Type
CHGDIR.COM 1108 700 deflated
CHGDIR.DOC 2324 1030 deflated

Download File CHGDIR15.ZIP Here

Contents of the CHGDIR.DOC file



CHGDIR Ver. 1.5 (c) 1989 W.C. Parke


CHGDIR is a batch file utility for changing drive and directory.
Its operation is similar to the DOS function CD. Unfortunately,
however, CD does not set the ERRORLEVEL index when an error
occurs. In a batch file, using CD to attempt to change to a
directory which may not exist will put you in a position of not
knowing if the change has occurred or not. CHGDIR solves this
problem by setting the ERRORLEVEL if either the drive or the
directory does not exist. Also, in contrast with the CD command,
CHGDIR can be used to actually change to another default drive.
Moreover, CHGDIR checks if the drive is functional before using
it as the new default drive. Aborting from an incorrectly
selected drive will not uncerimoniously abort the batch file. (My
thanks to Doug Clark for suggesting the latter safeguard.)

Syntax: CHGDIR {drive:}{\path}{/t}

where {drive:} is a drive index (such as A: )
{\path} is a directory path (e.g. \BIN )
{/t} is a switch (e.g. /T ).

Use switch /T to test for the existence of a drive
and/or directory path without actually changing
to that drive and/or directory.

If neither a drive nor a path name is given, a help screen is
displayed.

The following values of ERRORLEVEL is returned by CHGDIR:

0 No error occurred, drive and/or directory exist,
1 Drive does not exist or is unrecognized,
2 Drive is empty, door is open,
or disk is improperly inserted,
3 Disk in drive is unformated,
4 Disk was not formated by DOS,
5 Directory path does not exist.

Changes from Version 1.4:

1. Check now is made to see if requested drive is remote. If so,
CHGDIR will not attempt to read the disk boot track, looking
for the DOS signature. Thus, CHGDIR should now work on network
drives.

Changes from Version 1.3:

1. Expanded errorlevel values returned to include non-DOS disk test.

2. Removed user prompt if drive is found not ready. Responsibility
for user prompt is now given to batch file.



 December 19, 2017  Add comments

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)