JavaScript Editor js editor     Web development 

Main Page

Changes the default Visual FoxPro directory to the directory you specify.

CD cPath | CHDIR cPath



Specifies one of the following:
  • A drive designator

  • A drive designator with a directory

  • A child directory

  • Any of the above using MS-DOS shorthand notation (В \В or ..). When you include .. to change to the parent directory, you must include a space between CD or CHDIR and the two periods.


Use CD or CHDIR to specify the default Visual FoxPro directory. Visual FoxPro searches for files in the default Visual FoxPro directory. If Visual FoxPro cannot find a file in the default directory, it then searches the Visual FoxPro path if one has been specified. Use SETВ PATH to specify the Visual FoxPro path.

If you create a file and do not specify where to place it, the file is placed in the default Visual FoxPro directory.

You can locate hidden or system directories using CD and CHDIR. For more information, see FILE( ) Function and DIRECTORY( ) Function.

The CD and CHDIR commands are not supported in either single or multithreaded DLL servers. These commands change the default directory of the entire process, so all threads which are part of the process are affected. Use the SET PATH command in DLL servers, in place of SET DEFAULT.


The following example uses SET DEFAULT to change the default Visual FoxPro directory to the startup directory. It uses MKDIR to create a new directory named mytestdir, and CHDIR changes to the mytestdir directory. GETDIR(В ) shows you the directory structure in the Select Directory dialog box. You can then use SET DEFAULT to move your position back to the startup directory, RMDIR to remove the newly created directory, and GETDIR(В ) to display the original directory structure.

В Copy Code
MKDIR mytestdir  
CHDIR mytestdir  = GETDIR()  
RMDIR mytestdir  = GETDIR()  

See Also

JavaScript Editor js editor     Web development