Changing the Default Folder or Drive the ChDir and ChDrive Statements

You can easily change the default folder by using the ChDir statement, as follows:

ChDir Path

In the statement above, Path is the name of the new default folder. Path may include the name of the disk drive. If Path doesn't include a drive designation, the default folder will be changed on the current drive. The current drive will not be changed.

Suppose the default folder is "C:\DOS." The statement:

ChDir "D:\MyFiles"

changes the default folder to "D:\MyFiles"; however, the current drive is still drive C.

To change the current drive, you should use the ChDrive statement in the following format:

ChDrive drive

The drive argument specifies the letter of the new default drive. For instance, to change the default drive to drive D or E, enter one of the following instructions in the Immediate window:

ChDrive "D"

ChDrive "E"

If you refer to a nonexistent drive, you will get the message "Device unavailable."

0 0

Post a comment