Partager via


CURDIR( ) Function

Returns the current directory.

CURDIR([cExpression])

Return Value

Character

Parameters

  • cExpression
    Specifies the drive or volume for which CURDIR( ) returns the current directory or folder. If you omit cExpression, the current default drive or volume is assumed. The empty string is returned if the drive or volume you specify in cExpression doesn't exist. Note that this argument is only included for earlier versions of Visual FoxPro and FoxPro running under Window 3.1 or MS-DOS.

Remarks

CURDIR( ) returns, as a character string, the current MS-DOS directory on a specified drive.

Example

The following example stores the current directory to a variable, sets the default to the directory Visual FoxPro was started in, displays the new directory, returns the default to the original directory, and displays the original directory.

CLEAR
? 'Current directory: ', CURDIR( )
gcOldDir = SET('DEFAULT') + SYS(2003)
SET DEFAULT TO (HOME( ))
? 'Visual FoxPro directory: ', CURDIR( )
SET DEFAULT TO (gcOldDir)
? 'Current directory: ', CURDIR( )

See Also

Reference

FULLPATH( ) Function

HOME( ) Function

SYS(2003) - Current Directory

Other Resources

Functions

Language Reference (Visual FoxPro)