CurDir, CurDir$ (functions)

Syntax CurDir[$] [(drive$)]
Description Returns the current directory on the specified drive. If no drive$ is specified or drive$ is zero-length, then the current directory on the current drive is returned.
Comments CurDir$ returns a String , whereas CurDir returns a String variant. The script generates a runtime error if drive$ is invalid.
Example This example saves the current directory, changes to the next higher directory, and displays the change; then restores the original directory and displays the change. Note: The dot designators will not work with all platforms.
Const crlf = Chr$(13) + Chr$(10)
Sub Main()
  save$ = CurDir
  ChDir ("..")
  MsgBox "Old directory: " & save$ & crlf & "New directory: " & CurDir
  ChDir (save$)
  MsgBox "Directory restored to: " & CurDir
End Sub
See Also ChDir (statement); ChDrive (statement); Dir, Dir$ (functions); MkDir (statement); RmDir (statement).