CurDir 函数

返回一个表示指定驱动器的当前路径的变体字符串。

警告图标

This statement currently does not work as documented. See this issue for more information.


语法:

CurDir [(Text As String)]

返回值:

字符串

参数:

Text:用于指定现有驱动器的任意字符串表达式(例如,"C" 表示第一个硬盘驱动器的第一个分区)。

如果未指定驱动器或指定的驱动器是一个零长度字符串 (""),CurDir 将返回当前驱动器的路径。如果说明驱动器的语法不正确、驱动器不存在或者驱动器号出现在 CONFIG.SYS 中 Lastdrive 语句定义的驱动器号之后,LibreOffice Basic 将报告错误。

此函数不区分大小写。

错误代码:

5 无效的过程调用

68 设备不可用

7 内存不足

51 内部错误

示例:

Sub ExampleCurDir

Dim sDir1 As String , sDir2 As String

    sDir1 = "c:\Test"

    sDir2 = "d:\Private"

    ChDir( sDir1 )

    MsgBox CurDir

    ChDir( sDir2 )

    MsgBox CurDir

End Sub