Get Current Directory Method
The Get Current Directory method returns the default directory of a drive. If you specify a null ("") drive argument, or if you do not include the drive argument, then it returns the path for the default drive.
The drive that this method examines must exist, and it must reside in the range that the LASTDRIVE statement in the config.sys file specifies.
You can use a colon as part of the name of the drive but it is not required.
You can use the Change Drive method to change the current drive. You can use the Change Directory method to change the current directory.
Format
CurDir[$][(drive)]
For information about the dollar sign, see Usage of the Dollar Sign.
The following table describes the arguments that you can use with this method.
Argument | Description |
---|---|
drive |
The letter of the drive to search. |
Example
The following example changes the current directory to C:\Windows:
Sub Button_Click
Dim newdir as String
newdir = "c:\Windows"
If CurDir <> newdir then
ChDir newdir
End If
End Sub