Megosztás a következőn keresztül:


CD | CHDIR Command

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

CD cPath | CHDIR cPath

Parameters

  • 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.

Remarks

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 SETPATH 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.

Example

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.

SET DEFAULT TO HOME()  
MKDIR mytestdir  
CHDIR mytestdir  = GETDIR()  
SET DEFAULT TO HOME()  
RMDIR mytestdir  = GETDIR()  

See Also

DIR or DIRECTORY Command | DIRECTORY( ) | GETDIR( ) | HOME( ) | MD | MKDIR | RD | RMDIR | SET DEFAULT | SET PATH | SYS(5) - Default Drive | SYS(2003) - Current Directory | SYS(2004) - Visual FoxPro Start Directory